Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string problem

Status
Not open for further replies.

ebarratt

Programmer
Apr 10, 2002
53
0
0
US
Hey all,

Guess I'm flooding this board with questions, sorry about my lack of the vb.net syntax 8(. Anyway, i'm having problems with assigning values to a string variable from input controls like a textbox when the user enters in an apostrophe. You can view the error at when u type in a search keyword like children's, with the apostrophe. Is there a way for a vbstring variable to accept the aprostrophe? Any information or relevant links would be great! Thanks all.


Errol Errol Barratt
work: 856-810-5712
home: 856-697-1593
*** If there is a possibility, I'm sure all the smart ones out there will enlighten me 8p
 
It's not vb that's giving you that problem. It's a sqlException.

Replace ' with '' (which is double singles, not a single double) for any sql string, and you'll be fine
penny1.gif
penny1.gif
 
Just to further what Paul (link9) suggested, you could write a public function stored in a module in your project, that would take a string, find all the apostrophe's, and stick another one beside it (for the '' effect).

We do something similar for our web portal, and the beauty of writing one function is that all your textboxes can take advantage of it.

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top