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?

[Webinar] Streamline your web hosting managementRegister Today

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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
All Courses

From novice to tech pro — start learning today.