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

Recommended Answers

All 3 Replies

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.

thanx , its working . . .

Only a pleasure. Happy coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.