Hi.
I am using access(2003) db and there is a column that has "text" properties. I am trying to add a text with ( ' ) but I am getting unhandled error. How can i do that?
...
OleDbCommand cmd = new OleDbCommand(query,bag);
bag.Open();
cmd.ExecuteNonQuery();
Loading
Roei BarPosted Sep 26, 2009, 5:18 PM
string query = "INSERT INTO table (mtn_1) VALUES (['"+alt_mtn+"'])";
yokzuPosted Sep 26, 2009, 4:26 PM
string query = "INSERT INTO table (mtn_1) VALUES ('"+alt_mtn+"')";
I am assignning alt_mtn to a string text and it has ( ' ).
Dushan StankovicPosted Sep 26, 2009, 1:45 PM
Roei BarPosted Sep 26, 2009, 1:31 PM
To work arond this problem, do not use special characters. If you must use special characters in query expressions, enclose the special characters in brackets ([]). For example, if you want to use the greater than sign (>), use [>].
here is the KB on this issue from MS site
http://support.microsoft.com/kb/826763