473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 17 '05 #1
3 1035
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********@atginc.com> wrote in message
news:O5*************@TK2MSFTNGP09.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 17 '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********@atginc.com> wrote in message
news:O5*************@TK2MSFTNGP09.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 17 '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**************@TK2MSFTNGP12.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********@atginc.com> wrote in message
news:O5*************@TK2MSFTNGP09.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 17 '05 #4

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

Similar topics

12
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...
2
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 =...
11
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...
3
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
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"....
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
7
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
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...
1
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...
5
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.