access_asp thread: Syntax error in INSERT INTO statement
Message #1 by "Scott Fairbairn" <scott@l...> on Tue, 18 Mar 2003 15:26:12
|
|
Please help - I'm new to ASP, don't know syntax and need a quick fix...
I'm using an MS Access-based ASP-coded application. Can anyone see whats
wrong with this code and show me how to fix it so that I no longer get
the "Syntax error in INSERT INTO statement" error?
===
SQL = "Insert into tblCompany; Insert into tblPersonnel; Insert into
tblScheduleDetails (" &_
"CompanyName, " &_
"FName, " &_
"LName, " &_
"RoomNum, " &_
"MailStop, " &_
"PhoneNum1, " &_
"Email1, " &_
"AlternatePOC, " &_
"AlternatePOCPhone, " &_
"WebInfo) " & _
"VALUES ( "
SQL = SQL & CheckString(RF("CompanyName"),",")
SQL = SQL & CheckString(RF("FName"),",")
SQL = SQL & CheckString(RF("LName"),",")
SQL = SQL & CheckString(RF("RoomNum"), ",")
SQL = SQL & CheckString(RF("MailStop"), ",")
'SQL = SQL & CheckString(RF("State"), ",")
'SQL = SQL & CheckString(RF("PostalCode"), ",")
'SQL = SQL & CheckString(RF("Country"), ",")
SQL = SQL & CheckString(RF("PhoneNum1"), ",")
SQL = SQL & CheckString(RF("Email1"), ",")
SQL = SQL & CheckString(RF("AlternatePOC"), ",")
SQL = SQL & CheckString(RF("AlternatePOCPhone"), ",")
SQL = SQL & WebInfo(" ~~ ",True,True) & ")"
Message #2 by "Zee Computer Consulting" <zee@t...> on Tue, 18 Mar 2003 16:16:00 -0800
|
|
Scott,
The INSERT INTO keyphrase can only be used once per SQL statement and
only with one table at a time.
You should probably build three complete SQL statements to update the
three tables. (As it is now, we don't know which fields are in which table.)
-- Zee
----- Original Message -----
From: "Scott Fairbairn" <scott@l...>
To: "Access ASP" <access_asp@p...>
Sent: Tuesday, March 18, 2003 3:26 PM
Subject: [access_asp] Syntax error in INSERT INTO statement
> Please help - I'm new to ASP, don't know syntax and need a quick fix...
>
> I'm using an MS Access-based ASP-coded application. Can anyone see whats
> wrong with this code and show me how to fix it so that I no longer get
> the "Syntax error in INSERT INTO statement" error?
>
> ===
>
> SQL = "Insert into tblCompany; Insert into tblPersonnel; Insert into
> tblScheduleDetails (" &_
> "CompanyName, " &_
> "FName, " &_
> "LName, " &_
> "RoomNum, " &_
> "MailStop, " &_
> "PhoneNum1, " &_
> "Email1, " &_
> "AlternatePOC, " &_
> "AlternatePOCPhone, " &_
> "WebInfo) " & _
> "VALUES ( "
>
> SQL = SQL & CheckString(RF("CompanyName"),",")
> SQL = SQL & CheckString(RF("FName"),",")
> SQL = SQL & CheckString(RF("LName"),",")
> SQL = SQL & CheckString(RF("RoomNum"), ",")
> SQL = SQL & CheckString(RF("MailStop"), ",")
> 'SQL = SQL & CheckString(RF("State"), ",")
> 'SQL = SQL & CheckString(RF("PostalCode"), ",")
> 'SQL = SQL & CheckString(RF("Country"), ",")
> SQL = SQL & CheckString(RF("PhoneNum1"), ",")
> SQL = SQL & CheckString(RF("Email1"), ",")
> SQL = SQL & CheckString(RF("AlternatePOC"), ",")
> SQL = SQL & CheckString(RF("AlternatePOCPhone"), ",")
> SQL = SQL & WebInfo(" ~~ ",True,True) & ")"
>
|