Solved

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

Posted on 2006-07-13
7
277 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
  • 3
  • 3
7 Comments
 
LVL 92

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 125 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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…

839 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