473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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;
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
4 2321

I think if you want to write null as null and not as String into the DB
it is not correctly quoted!
Patrick Olurotimi Ige schrieb:
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;
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #2
So any idea?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #3
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;

"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:OZ**************@tk2msftngp13.phx.gbl...
So any idea?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Roger R. Smith | last post by:
I see this error in my ASP .NET code: I am trying to execute the following: private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName, User.LastName, User.Status, User.Phone,...
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
2
by: Patrick.O.Ige | last post by:
Can anybody body tell me what my error is here its saying :- System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'. SQLString = "UPDATE treetable SET " & _ "ParentID =...
3
by: Patrick.O.Ige | last post by:
Hi guys, I'm getting error:- System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='. What could cause this ERRORR My code below:- Dim connString As String =...
2
by: James Cooke | last post by:
Hi all, I want to catch a duplicate key exception. I do not want to provide that verbose message from the MSSQL server - I would put a user friendly message out, like "The item you have added...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
1
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the...
1
by: Ruth413 | last post by:
Hello - I am getting the these errors in my sql 2005 generated script. I am stuck with first error. Please help.... Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '('. Msg 319,...
3
by: weird0 | last post by:
This is the exception that I get when i create a webserivce obj and call. The error comes on the webmethod call, when it opens a connection to the db. How do I fix it? What is the solution to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.