What is wrong with the below code?
It gives me error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/w/results.asp, line 24
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; (R1 1.3); .NET CLR
1.1.4322; .NET CLR 2.0.50727)
Page:
POST 65 bytes to /w/results.asp
POST Data:
T3=ssdf&T1=sdf&D1=No&D2=Sabre&D3=Greaves+Travel&T2=&SUBMIT=Submit
----------------------------------
I have a file protected.asp and the below line to submit data into
database.
<form action="results.asp" METHOD="POST">
Following is the contents of results.asp
----------------------------------
<%@ Language=VBScript %>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
dim dDate,dPNR,dSale,dGDS,dWebsite,dOWebsite,sql,connString
dDate = Request.Form("T3")
dPNR = Request.Form("T1")
dSale = Request.Form("D1")
dGDS = Request.Form("D2")
dWebsite = Request.Form("D3")
dOWebsite = Request.Form("T2")
connString = "your connection string"
'conn.Open connString
sql = "INSERT INTO data ( Date, PNR_Number, Sale, GDS, Website,
Other_Website) VALUES ('" & dDate & "','" & dPNR & "','" & dSale &
"','" & dGDS & "','" & dWebsite & "','" & doWebsite & "');"
cst = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("DB\db1.mdb")
set conn = CreateObject("ADODB.Connection")
conn.open cst
conn.Execute sql
conn.Close
Response.Redirect("protected.asp")
end if
%>