Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT Statement with a quote (') in the Data

Status
Not open for further replies.

WoodyRoundUp

Programmer
Feb 28, 2001
187
AU
Hi guys.
I have a question.
I am using VB to write a program, where I will be using an SQL Statement to Insert Data into Table.
But, in the my SQL String, there are fields with a single quote (for example: Jack's)
But the Access Jet Engine will read it differently. and error happens.
Is there any way solve?

Anyway my sql string looks like this:
SQLStr = "INSERT INTO myTable VALUES ('" + myVariable.Text + "')"

while in the myVariable.Text = "Jack's"

the error is from the myVariable.Text.

Please help.
Thanks.
 
If you use ADO parameters this is taken care of for you.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top