SqlClient.SqlException: Line 1: Incorrect syntax near '='.

  • Thread starter Patrick Olurotimi Ige
  • Start date
P

Patrick Olurotimi Ige

why is this giving me error System.Data.SqlClient.SqlException: Line 1:
Incorrect syntax near '='.??
my code is in c#

strSql = "Update addmessage Set message = '"+null+"' Where ID=" +ID;

strSql = "Update addmessage Set message = '"+message+"' Where ID=" +ID;
 
C

Christian Filzwieser

I think if you want to write null as null and not as String into the DB
it is not correctly quoted!
 
T

Tampa.NET Koder

Do as Christian said. Do not make null a string ( don't include within a
single quote)

strSql = "Update addmessage Set message = "+ NULL +" Where ID=" +ID;
 
P

Patrick Olurotimi Ige

Thx for the reply....
The thing is 'm changing apps that has been built before..Guess store
procs would save my time
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top