Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi. i get this error when i want to add a new information :

http://imagizer.imageshack.us/a/img633/1524/vLYY5c.png[^]

and i get this error when i want to delete the file that i have saved ( this program is something like file manager and i can add name - size - quality and .... and we can see these informations in gridview and when u select a file and double click on it it will open u another windows that u can save pic or movie and ... for these file. now when i want to delete these pics or movies i get this error )

http://imagizer.imageshack.us/a/img907/9632/sobClQ.png[^]

so, why i get this error and how to fix it ?

thank u.
Posted
Updated 15-Dec-15 6:04am
v2

1 solution

Look at the error messages - they are pretty explicit.
The first one is obvious:
"Table 'Filelib' does not have the identity property"
So look at your UPDATE command and if you have a column called "Identity" then surround it with square brackets: "[Identity]"
Second, do note that an UPDATE query with no WHERE clause will affect every single row in the whole table...

The seconds one is harder:
"Incorrect syntax near '='"

Almost certainly it means you need to use a parameterised query instead of string concatenation: never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.

And in future, don't post rubbish screenshots - copy and paste the code and error message here instead. Screenshots of your errors are lazy and unhelpful because they cut off half the necessary information!
 
Share this answer
 
Comments
Richard Deeming 15-Dec-15 13:15pm    
I suspect the first error might be caused by a SET IDENTITY_INSERT [Filelib] ON statement at the start of the query.
brandon1999 15-Dec-15 13:31pm    
thank u guys so much and OK i don't post screenshots in future. thanks again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900