Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-10-2004, 01:20 PM   #1
Member (7 bit)
 
Join Date: Jun 2003
Location: Israel
Posts: 92
Send a message via ICQ to M.D.
Visual Basic - Dynamic queries with user parameters

Hi,

If i have some dynamic query like that:

"select * from table where columnX like '* " & param & " *' "

here param is parameter, that the user inserts.
If he inserts something like: ababba'ababab or ababab"ababa
this will crash.
How should i replace the characters: ' and " ???

(In java i would simply make PreparedStatement that will take care fothat itself automatically. Is there a simmiliar method here too, or i should do it manually and what exactly)

TNX
M.D. is offline   Reply With Quote
Old 10-10-2004, 05:52 PM   #2
Come in Ray...
 
faulkner132's Avatar
 
Join Date: Sep 2004
Posts: 1,668
In Microsoft SQL, I believe the escape char is represented by entering 2 of what you want in your SQL statement.
So for a single quote (') use '' (two single quotes), double quote use "", etc.

MySQL, I believe uses the forward slash (or back slash). Try both.
Single quote = /' (or \'), double quote = /" (or \"), etc.
faulkner132 is offline   Reply With Quote
Old 10-10-2004, 07:09 PM   #3
Member (7 bit)
 
Join Date: Jun 2003
Location: Israel
Posts: 92
Send a message via ICQ to M.D.
Thanks you very much. Ptoblem has been solved!!!
M.D. is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:54 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2