Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 12th, 2006, 6:18 AM   #1
dmcl2000
Newbie
 
Join Date: Dec 2005
Posts: 3
Rep Power: 0 dmcl2000 is on a distinguished road
Reading a string

Hi there!
Can anyone help me maybe with a small snippet of code. I am reading a string variable from a text file. The string may contain an aphostrophe which causes errors when I try to use it within a SQL query string command.
dmcl2000 is offline   Reply With Quote
Old Sep 12th, 2006, 6:20 AM   #2
dmcl2000
Newbie
 
Join Date: Dec 2005
Posts: 3
Rep Power: 0 dmcl2000 is on a distinguished road
I should have added the code is in VB6
dmcl2000 is offline   Reply With Quote
Old Sep 12th, 2006, 11:02 AM   #3
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Try checking to see if the string has any special characters before you use it in the SQL query.
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Sep 12th, 2006, 9:37 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Most databases have their own functions to escape a string so it can be used in a query. Find out what the function is in VB 6 for your database.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 13th, 2006, 6:14 AM   #5
dmcl2000
Newbie
 
Join Date: Dec 2005
Posts: 3
Rep Power: 0 dmcl2000 is on a distinguished road
Many thanks folks. As an update I will not be importing the errant string as it duplicates other data in the database. This was my first post and I'm impressed at the quick response
dmcl2000 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# corruption!!! Kilo C++ 32 May 21st, 2006 8:44 PM
Reading string with unknown substring treeninja Delphi 3 Feb 8th, 2006 12:26 PM
Array issues :( Alo Tsum Java 10 Nov 26th, 2005 5:45 PM
replace space with ' * ' TecBrain C++ 15 Apr 13th, 2005 12:32 PM
function solomon_13000 Java 6 Apr 2nd, 2005 11:42 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:34 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC