Start New Discussion within our Software Development Community

hello experts . . .
i am using following code:-
con.Execute "insert into tbl values('" & Text1.Text & "','" & Text2.Text & "') ", adCmdText
i am trying to insert data using above statement and its working well but an error occures when i input data (contaning the symbol ' )

for example when i input qwe'r it will give an error

So Any Solution to do so . . .

The following should do the trick -

con.Execute "insert into tbl values('" & Replace$(Text1.Text, "'", "''") & "','" & Text2.Text & "') ", adCmdText

''Assuming that Text1 will return the apostrophe character...

''Note the double '' inside there to still make the sql work.
This question has already been answered. Start a new discussion instead.