I need to run a 'select' query from VB6, that might contain a string with tags

I need to run a 'select' query from VB6, that might contain a string with tags in it,
 
for example:
 DB.OpenRecordset( "select * from X  where x.Name ='" & nameString & "'"
 
if the nameString variable contains tag in it, the operation will fail.
what can I do to overcome this problem.
yossikallyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
DB.OpenRecordset "select * from X  where x.Name ='" & replace(nameString, "'", "''") & "'")
0
 
Patrick MatthewsCommented:
Hi yossikally,

Please give an example of a nameString that causes a problem.

Regards,

Patrick
0
 
yossikallyAuthor Commented:
>>Please give an example of a nameString that causes a problem.

e.g.  'Thi'sIsInFrench'
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Then my suggestion applies.
0
 
yossikallyAuthor Commented:
I have heard that it is possible to submit an sql query with user defined delimiters
e.g.
1) [An SQL command which defines '$' to be my string delimiter]
2) a select query such as select * from X  where x.Name =$asd""rewrq''fgfds$, which would process the quotes as just another character.  can you give me some advice as per 1 above.

10x
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
This is not possible in MSSQL Server.
0
 
yossikallyAuthor Commented:
Thanks for the answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.