Hi
I have a problem with inserting strings.
I'm using MySql with a ODBC connection.
eg:
code = "mycode";
desc = "It's not working";
string sql = "";
sql = "insert into pasCustomerCodes(code,description) values('" + code + "','" + desc + "')";
OdbcCom = new System.Data.Odbc.OdbcCommand(sql, OdbcCon);
OdbcCom.ExecuteNonQuery();
---------
This gives an erro because of the ' character in the desc string.
Is there anything I can use to fix this?
Thanks
Loading
Gaurish KumarPosted Jan 19, 2010, 4:41 AM
Change this line of your code. and it works.
desc = "It''s not working";
Felipe MarksPosted Jan 22, 2010, 3:35 AM
Gaurish your idea is the one I'm going with. It's simple and it works. Thanks
Paul, I think you have the best answer, I don't have the MySql Library included so I didn't want to go that route.
paul danielPosted Jan 19, 2010, 8:20 AM
Sp code