473,394 Members | 2,071 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,394 software developers and data experts.

How insert query with right single quotation mark in Mysql in C#

2
hello every body

how can i get red of this error :
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near"

when i insert a new category in database i get this error since category name include single quotation mark.

example of Category name not accepted : un’ mecca

C;f : SELECT IdCategoria FROM categoria WHERE categoria.title='Familly’Ceka'

FYI : i use string.format() to design my query.

Please try to help me.
Sep 3 '09 #1
3 5060
mwasif
802 Expert 512MB
You need to escape quotation mark with \ e.g.

Expand|Select|Wrap|Line Numbers
  1. SELECT IdCategoria FROM categoria 
  2. WHERE categoria.title='Familly\’Ceka'
Sep 4 '09 #2
samour
2
thanks mwasif

it does'nt work, when i perform another replace like this :
ObjCategory.CategoryTitle.Replace("'", "''").Replace("’", @"\’")
the right single quotation mark will became a simple apostrophe.

- and when i update the category title directly in Mysql query browser, it accept this but when i wanna display categories in web application teh right single quotation mark will be shown like quarry
Sep 5 '09 #3
mwasif
802 Expert 512MB
I am moving this thread to C# for better response.
Sep 6 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: a-ok | last post by:
Hi, My client has a product database od around 20000 items. And it is updated every few days when he gets a catalog from the supplier. It's supposed to work like this: if there already is a...
3
by: Robert Garrett | last post by:
Hi, I've created a table in SQL Server 2000 and I'm now trying to search through the data and return specific rows. I'm using this command: select * from Export where libelle_court='Recherche...
4
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith">...
3
by: Patrick.O.Ige | last post by:
Hi, I have got this SQL below updating a textbox and a checkBox. strSql = "Update Products Set Discontinued=" & chkBoxChecked & ",ProductName = '" & ProductName & "' Where ProductID=" &...
1
by: kudeep | last post by:
Hi everyone i m new here. I have made an web application where user enter message and clicks on the SUBMIT button. Clickin on the SUBMIT button will execute a INSERT statement. Program works...
9
by: M P | last post by:
Hi! I am looking for a way that I can trap the single quotation mark. If an encoder uses single quotation mark on a textbox field, it always give me an error because I use single quotes on the...
3
by: Jacob Lyles | last post by:
Howdy, I'm a but of a newbie and I'd appreciate some help with a MySQL issue I'm having. I'm trying to insert some data into MySQL from a POST form but the query breaks whenever a user fails to...
9
by: davek | last post by:
(posted to: php.general, comp.lang.php, alt.php, alt.php.sql) I have a form where registered users on my site can edit their login details. For some reason, the script is inserting an extraneous...
1
by: U Aye Thein | last post by:
I found in internet how to solve single quotation mark in string and how to solve double quotation mark in string but my string may be contained single quote or double quote. How to write an...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.