Bug #13168 how to pass single quot in a query .
Submitted: 14 Sep 2005 7:35 Modified: 14 Sep 2005 7:54
Reporter: pardhasaradhi vemuri Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:mysql4.1 OS:Windows (windows advanced server)
Assigned to: CPU Architecture:Any

[14 Sep 2005 7:35] pardhasaradhi vemuri
Description:
hi, 
  pls help me how to pass single quot in a query in order to update a field in a table.
 i am using visual basic 6.0 and adodb connection object. 
 eg:
 txtitemsdesc="part's"
 con.execute("update partstable set itemdesc='" & txtitemsdesc & "'")
 
 here txtitemsdesc is a textbox
 con is a adodb connection object.
 
 i am getting a problem when the data has a single quot. please give me solution if any one know how to solve this. 

How to repeat:
just take a string and assign some data which has a single quot in it.
then use adodb connection object to update the field in the table.
dim str as string
dim con as new adodb.connection
str='hello guy's"
con.execute("update test set desc='" & str & "'")
[14 Sep 2005 7:54] Valeriy Kravchuk
We're sorry, but the bug system is not the appropriate forum for 
asking help on using MySQL products. Your problem is not the result 
of a bug.

Support on using our products is available both free in our forums
at http://forums.mysql.com and for a reasonable fee direct from our
skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

Additional info:

Hope the following will help you to solve your problem:

mysql> use test
Database changed
mysql> create table i1 (c1 char(10));
Query OK, 0 rows affected (0.09 sec)

mysql> insert into i1 values('part''s');
Query OK, 1 row affected (0.03 sec)

mysql> select * from i1;
+--------+
| c1     |
+--------+
| part's |
+--------+
1 row in set (0.00 sec)