1.11M Members

problem regarding insert into statement

 
0
 

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 . . .

 
0
 

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.
 
0
 

thanx , its working . . .

Question Answered as of 1 Year Ago by AndreRet
 
0
 

Only a pleasure. Happy coding.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article