access_asp thread: INSERT INTO that just won't work
Message #1 by "Joshua Serwatien" <webmaster@e...> on Thu, 20 Dec 2001 13:29:34
|
|
I have a form that sending an email to the system admin with the form's
info and logging the info into an Access table. If I run the following
query in Access, it works, but not in the ASP page:
INSERT INTO IDRequests (IType, FName, LName, Password, Department, Key,
Email, Login, Computer, Requestor, Comments)VALUES
('New', 'Joshua', 'Serwatien', '8521', 'Finance', 'Yes Please', 'Yes
Please','Yes Please', 'Yes Please', '2474', 'Comment')
The original query looks like this:
strSQL="INSERT INTO IDRequests (IType, FName, LName,
Password, Department, Key, Email, Login, Computer, Requestor, DateNeeded,
Comments)"
strSQL=strSQL & "VALUES ("
strSQL=strSQL & "'" & IType & "', "
strSQL=strSQL & "'" & FName & "', "
strSQL=strSQL & "'" & Lname & "', "
strSQL=strSQL & "'" & Password & "', "
strSQL=strSQL & "'" & Department & "', "
strSQL=strSQL & "'" & Key & "', "
strSQL=strSQL & "'" & Email & "',"
strSQL=strSQL & "'" & Login & "', "
strSQL=strSQL & "'" & Computer & "', "
strSQL=strSQL & "'" & Requestor & "', "
strSQL=strSQL & "'" & Ndate & "', "
strSQL=strSQL & "'" & Comments & "')"
If I just add the Fname, Lname and Department fields (the primary keys in
the table) it works, but once I try to add any other fields it gives me
the following error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/send/term/idhandle.asp, line 70
Browser Type:
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Page:
POST 219 bytes to /send/term/idhandle.asp
POST Data:
IType=New&Fname=Joshua&Lname=Serwatien&Password=8521&CPassword=8521&Departm
ent=Finance&Key=Yes+Please&Email=Yes+Please&Login=Yes+Please&Computer=Yes+P
lease&Requestor=2474&MPassword=2474&NDate=1%2F1%2F . . .
Help me please, for the love of all that's Holy!
Message #2 by "Zee Computer Consulting" <zee@t...> on Thu, 20 Dec 2001 13:15:59 -0800
|
|
Maybe a space after the closing parenthesis and before VALUES.
-- Z
----- Original Message -----
From: "Joshua Serwatien" <webmaster@e...>
To: "Access ASP" <access_asp@p...>
Sent: Thursday, December 20, 2001 1:29 PM
Subject: [access_asp] INSERT INTO that just won't work
> I have a form that sending an email to the system admin with the form's
> info and logging the info into an Access table. If I run the following
> query in Access, it works, but not in the ASP page:
>
> INSERT INTO IDRequests (IType, FName, LName, Password, Department, Key,
> Email, Login, Computer, Requestor, Comments)VALUES
> ('New', 'Joshua', 'Serwatien', '8521', 'Finance', 'Yes Please', 'Yes
> Please','Yes Please', 'Yes Please', '2474', 'Comment')
>
> The original query looks like this:
>
> strSQL="INSERT INTO IDRequests (IType, FName, LName,
> Password, Department, Key, Email, Login, Computer, Requestor, DateNeeded,
> Comments)"
> strSQL=strSQL & "VALUES ("
> strSQL=strSQL & "'" & IType & "', "
> strSQL=strSQL & "'" & FName & "', "
> strSQL=strSQL & "'" & Lname & "', "
> strSQL=strSQL & "'" & Password & "', "
> strSQL=strSQL & "'" & Department & "', "
> strSQL=strSQL & "'" & Key & "', "
> strSQL=strSQL & "'" & Email & "',"
> strSQL=strSQL & "'" & Login & "', "
> strSQL=strSQL & "'" & Computer & "', "
> strSQL=strSQL & "'" & Requestor & "', "
> strSQL=strSQL & "'" & Ndate & "', "
> strSQL=strSQL & "'" & Comments & "')"
>
> If I just add the Fname, Lname and Department fields (the primary keys in
> the table) it works, but once I try to add any other fields it gives me
> the following error:
>
> Error Type:
> Microsoft JET Database Engine (0x80040E14)
> Syntax error in INSERT INTO statement.
> /send/term/idhandle.asp, line 70
>
>
> Browser Type:
> Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
>
> Page:
> POST 219 bytes to /send/term/idhandle.asp
>
> POST Data:
>
>
IType=New&Fname=Joshua&Lname=Serwatien&Password=8521&CPassword=8521&Departm
>
>
ent=Finance&Key=Yes+Please&Email=Yes+Please&Login=Yes+Please&Computer=Yes+P
> lease&Requestor=2474&MPassword=2474&NDate=1%2F1%2F . . .
>
> Help me please, for the love of all that's Holy!
$subst('Email.Unsub').
Message #3 by "Joshua Serwatien" <webmaster@e...> on Thu, 20 Dec 2001 21:34:34
|
|
Na, I tried that already.
Message #4 by Netalix <netalix@y...> on Thu, 20 Dec 2001 14:12:09 -0800 (PST)
|
|
I had a simalar problem, just a few hours ago.
Password is a Access Reserved word. Don't ask me why, but if you do it
in Access, viola it works, drop it in .asp and it bombs with a pretty
error message.
-Kevin(A.S.)
--- Joshua Serwatien <webmaster@e...> wrote:
> Na, I tried that already.
$subst('Email.Unsub').
=====
May the Penguin be with you!
(o_ Kevin Poorman
//\ Netalix@Y...
V_/_ AOLIM: Netalix, Shyslpwlkr or TheUnchosen1
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
Message #5 by "Ken Schaefer" <ken@a...> on Fri, 21 Dec 2001 12:28:27 +1100
|
|
www.adopenstatic.com/faq/80040e14.asp
(look at Scenario 2 - Syntax Error in INSERT INTO statement)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Joshua Serwatien" <webmaster@e...>
Subject: [access_asp] INSERT INTO that just won't work
: I have a form that sending an email to the system admin with the form's
: info and logging the info into an Access table. If I run the following
: query in Access, it works, but not in the ASP page:
:
: INSERT INTO IDRequests (IType, FName, LName, Password, Department, Key,
: Email, Login, Computer, Requestor, Comments)VALUES
: ('New', 'Joshua', 'Serwatien', '8521', 'Finance', 'Yes Please', 'Yes
: Please','Yes Please', 'Yes Please', '2474', 'Comment')
:
: The original query looks like this:
:
: strSQL="INSERT INTO IDRequests (IType, FName, LName,
: Password, Department, Key, Email, Login, Computer, Requestor, DateNeeded,
: Comments)"
: strSQL=strSQL & "VALUES ("
: strSQL=strSQL & "'" & IType & "', "
: strSQL=strSQL & "'" & FName & "', "
: strSQL=strSQL & "'" & Lname & "', "
: strSQL=strSQL & "'" & Password & "', "
: strSQL=strSQL & "'" & Department & "', "
: strSQL=strSQL & "'" & Key & "', "
: strSQL=strSQL & "'" & Email & "',"
: strSQL=strSQL & "'" & Login & "', "
: strSQL=strSQL & "'" & Computer & "', "
: strSQL=strSQL & "'" & Requestor & "', "
: strSQL=strSQL & "'" & Ndate & "', "
: strSQL=strSQL & "'" & Comments & "')"
:
: If I just add the Fname, Lname and Department fields (the primary keys in
: the table) it works, but once I try to add any other fields it gives me
: the following error:
:
: Error Type:
: Microsoft JET Database Engine (0x80040E14)
: Syntax error in INSERT INTO statement.
: /send/term/idhandle.asp, line 70
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #6 by "Joshua Serwatien" <webmaster@e...> on Fri, 21 Dec 2001 14:11:31
|
|
Ken, you've got to laugh at this. I tried putting [] around the database
field names, just for kicks, and the error I got back was a missing
operant. Turns out I left out the ; @ the end of the query. Go
figure...Thank for your help.
|