?
Solved

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

Posted on 2006-07-13
7
Medium Priority
?
296 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:yossikally
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 17098809
Hi yossikally,

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

Regards,

Patrick
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17098893
DB.OpenRecordset "select * from X  where x.Name ='" & replace(nameString, "'", "''") & "'")
0
 

Author Comment

by:yossikally
ID: 17098923
>>Please give an example of a nameString that causes a problem.

e.g.  'Thi'sIsInFrench'
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17098932
Then my suggestion applies.
0
 

Author Comment

by:yossikally
ID: 17099141
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
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17099327
This is not possible in MSSQL Server.
0
 

Author Comment

by:yossikally
ID: 17099369
Thanks for the answer.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question