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

writing quotes to database

When you type a quote in a name for example, the database is returning
an error...
Now i only check the name field and replace every quote to \'

Is there a simple thing to replace all special characters with
something that can be inserted into a database?

I'm using asp.net with VB, and a MySQL database (using SQL server also
gives errors)

--
Greetz, Netfreaky
http://www.netfreaky.be
Nov 18 '05 #1
3 1061
You should use ADO.NET parameter objects. They will solve this problem and
similar problems and protect you against SQL Injection Attacks.
Here's more info:
http://msdn.microsoft.com/library/de...classtopic.asp
us/dv_vbcode/html/vbtskcodecallingparameterizedstoredprocedurevisual basic.as
p

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Netfreaky" <us*****************@pandora.belgium.invalid> wrote in message
news:Xn***********************@195.130.132.70...
When you type a quote in a name for example, the database is returning
an error...
Now i only check the name field and replace every quote to \'

Is there a simple thing to replace all special characters with
something that can be inserted into a database?

I'm using asp.net with VB, and a MySQL database (using SQL server also
gives errors)

--
Greetz, Netfreaky
http://www.netfreaky.be

Nov 18 '05 #2
replace it with '' (that's two single quotes) not \'
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Netfreaky" <us*****************@pandora.belgium.invalid> wrote in message
news:Xn***********************@195.130.132.70...
When you type a quote in a name for example, the database is returning
an error...
Now i only check the name field and replace every quote to \'

Is there a simple thing to replace all special characters with
something that can be inserted into a database?

I'm using asp.net with VB, and a MySQL database (using SQL server also
gives errors)

--
Greetz, Netfreaky
http://www.netfreaky.be

Nov 18 '05 #3
Use parameters, man :)
"Netfreaky" <us*****************@pandora.belgium.invalid> wrote in message
news:Xn***********************@195.130.132.70...
When you type a quote in a name for example, the database is returning
an error...
Now i only check the name field and replace every quote to \'

Is there a simple thing to replace all special characters with
something that can be inserted into a database?

I'm using asp.net with VB, and a MySQL database (using SQL server also
gives errors)

--
Greetz, Netfreaky
http://www.netfreaky.be

Nov 18 '05 #4

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

Similar topics

8
by: Deepa | last post by:
I am writing a console app in c# wherein am converting a dataset into a CSV file. It works fine. But I have some values in the dataset which have a comma within(eg. A,B,C). When I view the CSV file...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
8
by: Deepa | last post by:
I am writing a console app in c# wherein am converting a dataset into a CSV file. It works fine. But I have some values in the dataset which have a comma within(eg. A,B,C). When I view the CSV file...
1
by: Mudcat | last post by:
In short what I'm trying to do is read a document using an xml parser and then upload that data back into a database. I've got the code more or less completed using xml.etree.ElementTree for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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.