Hi,
I have a form where the user enters a customer name, then clicks the submit
button which then adds it to a database. This works absolutely fine untill
the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this
error.....
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression ''O'Hanlon'
any help would be great, and yes I'm a newbie!!
thanks in advance
Paul 5 1842
"Paul Malbon" <no****@all.com> wrote: Hi,
I have a form where the user enters a customer name, then clicks the submit button which then adds it to a database. This works absolutely fine untill the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this error..... Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression ''O'Hanlon'
Most likely the apostrophe appears as an extra delimiter in the SQL
statement that's used to update the DB. The solution is to double the
apostrophe before presenting the field to the database.
--
Tim Slattery
MS MVP(DTS) Sl********@bls.gov
Paul Malbon wrote: Hi,
I have a form where the user enters a customer name, then clicks the submit button which then adds it to a database. This works absolutely fine untill the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this error..... Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression ''O'Hanlon'
any help would be great, and yes I'm a newbie!! thanks in advance
Another delimiter problem caused by the use of dynamic sql instead of
parameters. Tim explained about escaping your apostrophe by doubling it, but
there are other potential problems caused by the use of dynamic sql. Read: http://mvp.unixwiz.net/techtips/sql-injection.html http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl http://groups.google.com/groups?hl=e...tngp13.phx.gbl
Using Command object to parameterize CommandText: http://groups-beta.google.com/group/...e36562fee7804e
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Thanks for the reply tim. I should have been a bit more clearer in my post.
I realise that the error is caused by the apostrophe.
You say double the apostrophe. Do you mind me asking how I would do that?
This web based form will be used by people who generally dont use the
internet and to ask them to 'double apostrophe' would confuse them no end!!
Thanks again for your assitance
"Tim Slattery" <Sl********@bls.gov> wrote in message
news:9v********************************@4ax.com... "Paul Malbon" <no****@all.com> wrote:
Hi,
I have a form where the user enters a customer name, then clicks the submit button which then adds it to a database. This works absolutely fine untill the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this error..... Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression ''O'Hanlon'
Most likely the apostrophe appears as an extra delimiter in the SQL statement that's used to update the DB. The solution is to double the apostrophe before presenting the field to the database.
-- Tim Slattery MS MVP(DTS) Sl********@bls.gov
No no no. He's telling you to do it in your code that builds the sql
statement that inserts the value into your database. See http://groups.google.com/group/micro...UTF-8&oe=UTF-8
dim s, sql
s=request.form("form_field")
s=replace(s,"'","''")
sql="insert into ... values ('" & s & "', ...)"
Paul Malbon wrote: Thanks for the reply tim. I should have been a bit more clearer in my post. I realise that the error is caused by the apostrophe.
You say double the apostrophe. Do you mind me asking how I would do that? This web based form will be used by people who generally dont use the internet and to ask them to 'double apostrophe' would confuse them no end!! Thanks again for your assitance
"Tim Slattery" <Sl********@bls.gov> wrote in message news:9v********************************@4ax.com... "Paul Malbon" <no****@all.com> wrote:
Hi,
I have a form where the user enters a customer name, then clicks the submit button which then adds it to a database. This works absolutely fine untill the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this error..... Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression ''O'Hanlon'
Most likely the apostrophe appears as an extra delimiter in the SQL statement that's used to update the DB. The solution is to double the apostrophe before presenting the field to the database.
-- Tim Slattery MS MVP(DTS) Sl********@bls.gov
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Reading and digesting now. Thanks for your time
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uV**************@TK2MSFTNGP14.phx.gbl... Paul Malbon wrote: Hi,
I have a form where the user enters a customer name, then clicks the submit button which then adds it to a database. This works absolutely fine untill the name has an apostrophe in it.
eg when the name entered is O'Hanlon and its submitted, I get this error..... Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression ''O'Hanlon'
any help would be great, and yes I'm a newbie!! thanks in advance Another delimiter problem caused by the use of dynamic sql instead of parameters. Tim explained about escaping your apostrophe by doubling it, but there are other potential problems caused by the use of dynamic sql. Read: http://mvp.unixwiz.net/techtips/sql-injection.html http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
http://groups.google.com/groups?hl=e...tngp13.phx.gbl
Using Command object to parameterize CommandText: http://groups-beta.google.com/group/...e36562fee7804e
HTH, Bob Barrows
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Juergen Gerner |
last post by:
Hello Python fans,
I'm trying and searching for many days for an acceptable solution...
without success. I want to store files in a database using BLOB
fields. The database table has an ID field...
|
by: fish |
last post by:
Hi,
I have an HTML page with a FORM and some input fields.
On the fields I wish to do validation as the punters change the field
values.
If they get it wrong, then I tell them and then wish...
|
by: Ed |
last post by:
Hoping someone an assist me urgently. I would truly appreciate and help.
I have a form and prices are based on 'price break'.
1.The price break fields work fine, but I cannot for the life of me...
|
by: Axel |
last post by:
Hi
in T-SQL,
(how) is it possible to concatenate 3 (varchar) fields into one; either
in a SQL query or through a calculated field (or using a view, if
anybody can explain to me how to use...
|
by: svet |
last post by:
Hello,
I need to import data into integer field in Access but
would like to trim the lenght of the field to 4 char. long
instead of the default six char. long. This is important,
because on...
| |
by: Louis |
last post by:
I'm using a form to append records to a Request table. On the form is
a Text Box for users to enter the description of the request and it
can be quite lengthy. When I use an append query to...
|
by: MLH |
last post by:
I have a form with two controls:
!! - combo box
!! - text box
A button on the form tries to run this SQL when clicked...
INSERT INTO BodyMsgsSent (ToWhom, BodyText)
SELECT DISTINCTROW !! AS...
|
by: h7qvnk7q001 |
last post by:
I'm trying to implement a simple server-side form validation (No
Javascript). If the user submits a form with errors, I want to
redisplay the same form with the errors highlighted. Once the form...
|
by: Summercool |
last post by:
the sticky form is that if validation didn't pass, re-display the form
with the value in the text input again (and for other input field as
well...)
no book I read did it correctly so far. ...
|
by: manifestcomms |
last post by:
Hello,
I have a form which requires the fields to be valid before the buttons become active. In particular I am having a problem with the email address field.
The form is written in PHP using a...
|
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...
| |
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...
|
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: 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: 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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |