473,790 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass special characters in Update stmt!!

Jay

Hello,

I need to use Update Sql stmt from my page.

Some of the field values has apostrophes and and quotes.

How do I make ado.net ignore those characters?
Eg-
UPDATE ROOM SET HEIGHT='3' - 5"' WHERE RMNU='100'
Iam using c#.

Thanks.
Jay

Nov 15 '05 #1
3 1954
SQL server string literals allow two single quotes (apostrophes) to
represent a single quote. Double quotes don't matter.

So your line should be:

UPDATE ROOM SET HEIGHT='3'' - 5"' WHERE RMNU='100'

"Jay" <pr********@atg inc.com> wrote in message
news:O5******** *****@TK2MSFTNG P09.phx.gbl...

Hello,

I need to use Update Sql stmt from my page.

Some of the field values has apostrophes and and quotes.

How do I make ado.net ignore those characters?
Eg-
UPDATE ROOM SET HEIGHT='3' - 5"' WHERE RMNU='100'
Iam using c#.

Thanks.
Jay

Nov 15 '05 #2
Jay,

You can use paramers in the sql query and you can pass whatever the special
characters you want to pass into the SQL query without any problem.
Use SqlCommand or OleDBCommand object and use its parameters collection for
your where clause or SET clause.

Thanks
Nedu
"Jay" <pr********@atg inc.com> wrote in message
news:O5******** *****@TK2MSFTNG P09.phx.gbl...

Hello,

I need to use Update Sql stmt from my page.

Some of the field values has apostrophes and and quotes.

How do I make ado.net ignore those characters?
Eg-
UPDATE ROOM SET HEIGHT='3' - 5"' WHERE RMNU='100'
Iam using c#.

Thanks.
Jay

Nov 15 '05 #3
I second that...params are better in every regard that I can think of.
"Nedu N" <ne****@hotmail .com> wrote in message
news:eb******** ******@TK2MSFTN GP12.phx.gbl...
Jay,

You can use paramers in the sql query and you can pass whatever the special characters you want to pass into the SQL query without any problem.
Use SqlCommand or OleDBCommand object and use its parameters collection for your where clause or SET clause.

Thanks
Nedu
"Jay" <pr********@atg inc.com> wrote in message
news:O5******** *****@TK2MSFTNG P09.phx.gbl...

Hello,

I need to use Update Sql stmt from my page.

Some of the field values has apostrophes and and quotes.

How do I make ado.net ignore those characters?
Eg-
UPDATE ROOM SET HEIGHT='3' - 5"' WHERE RMNU='100'
Iam using c#.

Thanks.
Jay


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
28588
by: Mosher | last post by:
Hi all, I have an issue with php and/or mysql. I have a php form that writes "items" to a mysql database, including a description of the item. On the mysql server, "magic_quotes_gpc" is ON. I am testing it now by putting special characters in the description field, this is what I am entering: O'Leary "special edition"
2
16042
by: Egghead | last post by:
Hi all, How can I pass special characters into a function, such as : I want to replace " in mystring mystring = replace(mystring,"\"","") <--not working same as in C# mystring = mystring.Replace("\"", " ") thanks
11
8354
by: T O | last post by:
Hi all, I am very new to C programming and have come across problem. My programme has opened and created a text document on the hard drive. The document name is stored in a string called "output". At the end of the program, I want to open the outputfile.txt automatically using notepad.
3
1060
by: Jay | last post by:
Hello, I need to use Update Sql stmt from my page. Some of the field values has apostrophes and and quotes. How do I make ado.net ignore those characters? Eg- UPDATE ROOM SET HEIGHT='3' - 5"' WHERE RMNU='100'
5
8632
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file". Same file path containing special characters works fine in one machine, but doesn't work in other. I am using following API function to get short file path. Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As
7
4923
by: Trac Bannon | last post by:
When I load XML from a file into a dotNet XMLDataDocument, the UTF-8 codes are resolved but the 5 special XML entities are not. How can I force those 5 special character types to be translated?
1
3043
by: ronrsr | last post by:
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.
1
1780
by: ronrsr | last post by:
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.
5
11168
by: Sobin Thomas | last post by:
Hi All, I want to pass a string that contains many special characters (: \ . _ etc) to another page in my website through query string. In my project I have a Gridview control ,in which there is a hyperlink field.The Gridview 's datasource is set as a database table at runtime.The hyperlink filed's DataNavigateUrlFields is set to "RecordID" ,which is a field in my database table.The RecordID field contains many special characters.I...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.