incorrect syntax near 'nvarchar' must declare scalar variable

incorrect syntax near 'nvarchar' must declare scalar variable

While working with the built in update command, i had this error "incorrect syntax near 'nvarchar' must declare scalar variable".

Only Update seems affected

The delete, insert, and new rows all seemed to work fine, it was just the update command that was failing.

Solution

Check the SqlDataSource object for any fields you've pulled or renamed with spaces in them. An '_' Underscore will work fine, but doing a query like this "Select [somename] as [Some Name] FROM [names] WHERE [id]=@id" will result in the above error.

Other Fixes

Other fixes, that didn't work for me, is to rebuild the solution or copy the code and paste it into a new document and replace the old document with the new one.

Comments
Only registered users can leave comments.
Comment text: