Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what's wrong with this sql???

Status
Not open for further replies.

SirLars

Technical User
Oct 24, 2000
47
CA
----code clip starts-------
<%
'this file is to create an array called players to delete then delete's them from the list

dim playercount
playercount=Request.form(&quot;playercount&quot;)

dim playerstodelete
playerstoconfirm=Request.form(&quot;confirm&quot;)
paid=&quot;paid&quot;
itstrue=&quot;yes&quot;

sql3 = &quot;INSERT INTO Results (deposit_paid) VALUES ('&quot; & paid & &quot;') WHERE ID IN (&quot;& playerstoconfirm &&quot;)&quot;
accessdb=&quot;../../../../ohio&quot;
dim DSNstring
DSNstring= &quot;DBQ=&quot; & server.mappath(accessdb) & &quot;;DRIVER={Microsoft Access Driver (*.mdb)}&quot;

dim objConn
set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Connectionstring = DSNstring

objConn.Open

Response.Write &quot;----- there are currently :&quot; & playercount & &quot; in the database&quot; & chr(13)
Response.Write sql3 & chr(13)


if playerstoconfirm <> &quot;&quot; then
Response.Write &quot; ---- SQL confirming players :&quot; & playerstoconfirm & chr(13)
objConn.Execute sql3
end if
objConn.Close

Set objConn = Nothing

%>

----- code clip ends ------
confirm is a set of numbers passed to this asp page from a form

=======here's my output======

----- there are currently :2 in the database
INSERT INTO Results (deposit_paid) VALUES ('paid') WHERE ID IN (1, 2)
---- SQL confirming players :1, 2

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Missing semicolon (;) at end of SQL statement.

/confirmindbase.asp, line 30

===== end of output ======

now.. it says to add a semicolon.. but when i do the page won't run at all...

this same basic script works with the delete function i've used... so i'm sure it's my sql statement...

thanks..
Lars
 
Mybe u need
accessdb=&quot;../../../../ohio.mdb&quot;
________
George, M
 
no that's not the problem...

it reads the database fine..
i need to know if i'm using the correct syntax for the INSERT INTO sql statement with

INSERT INTO Results (deposit_paid) VALUES ('paid') WHERE ID IN (1, 2)
 
If u need to insert an value u dont need where clause to do that cuz it inserts the value not updates the values...
this is for inserting an value
INSERT INTO Results (deposit_paid) VALUES ('paid')
this is for updating values
UPDATE Results SET deposit_paid='paid' WHERE WHERE ID IN (1, 2)
________
George, M
 
thank you very much george, that did it.

i am a beginner in asp page programming and database management, and i have found it daunting to say the least...

i really appreciate your help (and the help of all the people in this forum) it's a great service.

Lars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top