| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Syntax error - help ?
Hey,
I get this error with my code, and I have no idea why, can you PLEASE help me Thanks Twe Microsoft JET Database Engineerror '80040e14' Syntax error in INSERT INTO statement. /work/flightbooking.asp, line 39 <% Form_bookingid = Trim(Replace(Request.Form("bookingid"),"""","""""")) Form_seatnumber = Trim(Replace(Request.Form("seatnumber"),"""","""""")) Form_typeofperson = Trim(Replace(Request.Form("typeofperson"),"""","""""")) Form_passengername = Trim(Replace(Request.Form("passengername"),"""","""""")) Form_flightcode = Trim(Replace(Request.Form("flightcode"),"""","""""")) %> <HTML> <BODY> Error. Click back in your browser, and fill it out properly! All fields are required. </HTML> </BODY> <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "C:\Inetpub\wwwroot\work\project.mdb" sql="INSERT INTO PassengerBooking (BookingID," sql=sql & "BookingSeat,PassengerName,BookingPersonType,Flight ID" sql=sql & " VALUES " sql=sql & "('" & Request.Form("bookingid") & "'," sql=sql & "'" & Request.Form("seatnumber") & "'," sql=sql & "'" & Request.Form("typeofperson") & "'," sql=sql & "'" & Request.Form("passengername") & "'," sql=sql & "'" & Request.Form("flightcode") & "')" conn.Execute sql,recaffected conn.close %> <HTML> <BODY> <B>Thank you for booking a flight, if you wish to make another booking, please go back and use the same booking ID</B> </HTML> </BODY> <% END IF %> |
|
#2
|
||||
|
||||
|
Text data types are surrounded by (') single quotes, number types aren't.
If BookingID and FlightID are numbers in the database, then try this. Code:
strSql = "INSERT INTO PassengerBooking(BookingID, BookingSeat, PassengerName, BookingPersonType, FlightID) VALUES(" & Request.Form("bookingid") & ", '" & Request.Form("seatnumber") & "', '" & Request.Form("typeofperson") & "', '" & Request.Form("passengername") & "', " & Request.Form("flightcode") & ")"
Last edited by Memnoch : April 18th, 2004 at 12:53 PM. |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Syntax error - help ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|