SQL command problem
Hey all
I'm having trouble with SQL commands that contain single quote characters. It seems that single quote characters in a SQL command confuse the darn thing. Example:
---------------------------------------
// the text I want to store in the SQL database
string text = "Here is a single line quote ' there it was";
string sqlCommand = string.Format("Update myDataTable set Text = '{0}', where (ID = 3456781)", text);
---------------------------------------
When I .ExecuteNonQuery(), it will throw an exception telling my I've got bad sql command syntax due to the single quote character in text. It works fine if I take the single quote character out.
Now I'm very new to SQL, so I'm probably missing something simple. How do I get around this simple syntax issue? Mr. Chornberger, I'm looking your way. :)
chrishornbergerPosted Sep 29, 2003, 1:58 PM
Mahesh ChandPosted Sep 29, 2003, 1:46 PM
chrishornbergerPosted Sep 29, 2003, 1:18 PM
Mahesh ChandPosted Sep 29, 2003, 12:54 PM
ssswamiiPosted Sep 29, 2003, 12:28 PM