If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
Hi guys! Is it posible to insert a value with single quote(') in ms excel? My current code is displayed below. But when I try to insert a string say, "This message contains single quote(')" an error will occur stating
Quote:
Missing semicolon ( at end of SQL statement.
Thanks in advance!
Code:
Quote:
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=myDB.xls";Extended Properties=\"Excel 8.0;HDR=YES\"");
OleDbCommand command = new OleDbCommand();
command.Connection = conn;
command.CommandText = "INSERT INTO myTable values('This message contains single quote(')');
conn.Open();
command.ExecuteNonQuery();