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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proplems executing an SQL INSERT statements on an Access Database

Status
Not open for further replies.

Jamin79

Programmer
May 23, 2001
9
GB
Hi, I'm trying to add a record into a database using and SQL INSERT statement and I'm receiving the following error:

No value given for one or more required parameters.

the abridged code for the statement is as follows:

Dim strconn
Dim conn

strconn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strconn=strconn & server.mappath("../database/server.mdb") & ";"
set conn = Server.CreateObject("ADODB.Connection")
conn.open strconn

insertRec = "INSERT INTO booking (showingID, card_number, date_booked, number_adult_seats, number_concession_seats, seat_type, payment_amount) VALUES (CLng(showingID), cardNo, dateBooked, noASeat, noCSeat, seatType, price)"

conn.Execute(insertRec)

conn.close
strconn = Nothing

The error points to the conn.Execute(insertRec) statement. I've checked the SQL and it seems to be in order and all the fields to be input are present and seem to have the correct data types. Basically I'm stumped. Can anyone help?

Thank you in advance,

Ben.
 
Hi, Please disreguard the above I've got it sorted.

Thanks,

Ben.
 
Now i see the mistake in yours...but I still can't get my insert to work! where you just missing the ' ' around the values? ...or was there something else?
 
The values I was trying to use were variables so I needed to close the string and use + to add the content so it would be:

VALUES ('" + CLng(showingID) + "','" + cardNo + "','" + "','" + dateBooked.....etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top