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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting invalid query characters

Status
Not open for further replies.

ryebread

Programmer
Aug 13, 2001
29
US
Does anybody know of a way to convert characters like ' and " into a format that would be safe to pass into a SQL query?

 
Use Replace(txtName.Text, "'", "''")
Notice, It's two 's instead of " you are going to replace '.
Hope this answers your question.
 
I solved my problem. I used a SqlCommand object and passed all my variables in using parameters.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top