Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-13-2005, 06:21 PM   PM User | #1
tib
New Coder

 
Join Date: Apr 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
tib is an unknown quantity at this point
updating filed with ' in it

Hi I have a field that may have a ' in it and seeing as though it is a text field in the update statement that I am building i have

update table set field = ' " & str & " ' "

if the str variable has a ' in it the it returns an error, how can i get around this, thanks for any input
tib is offline   Reply With Quote
Old 09-13-2005, 07:17 PM   PM User | #2
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Did you mean to put this in the Classic ASP forum?
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 09-14-2005, 03:16 AM   PM User | #3
rrhodes
New Coder

 
Join Date: Aug 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
rrhodes is an unknown quantity at this point
If you're using ASP.NET and using its built in web controls and use CommandParameters with the SqlCommand class, this is a total non-issue.
__________________
Robert
Gee! Web Tools
Web Content Management / Internet Marketing modules including:
Page Editor - Calendar Manager - News Editor - Contact Organizer - Mail Wizard
rrhodes is offline   Reply With Quote
Old 09-14-2005, 05:44 PM   PM User | #4
tib
New Coder

 
Join Date: Apr 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
tib is an unknown quantity at this point
I am using a datagrid with the oneditcommand and onupdatecommand, it was giving me an error where there was a ', so what i did was i replaced the ' with '' (2 single quotes) and then the sql stmt ran fin bc asp.net treats '' as a single quote in a string surrounded by double quotes. Just thought I'd share that incase anyone else is having that trouble
tib is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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 Off

Forum Jump


All times are GMT +1. The time now is 08:31 AM.


Advertisement
Log in to turn off these ads.