Hi,
I am gathering the input values to a form using Request.form method from the
processing page. After all the data is captured, I am building sql statement
out of it. Using a response.write statement, I am generating the output of
the sql statement which I can ran against the table to insert the row.
However, when I am trying to programmaticall y use the sql statement for the
insert, I am having the following error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/indianland/mainentry_proce ss.asp, line 94
I am attaching the processing code here where line 94 is the following
statement:
conn.execute(st rSQL)
I have no idea why this is producing an error. Any help is appreciated.
CODE:
<!-- #include file="connectio n.asp" -->
<!-- #include file="adovbs.in c" -->
<HTML>
<HEAD>
<META NAME="GENERATOR " Content="Micros oft Visual Studio 6.0">
</HEAD>
<BODY>
<%
ApplicantIntID = Request.Cookies ("ApplicantIntI D")
Dim l_p_Agency
Dim l_p_lstOffense
Dim l_p_CountTotalO ffenses
Dim l_p_CountCleare dByArrestOrExce ptionalMeans
Dim l_p_CountOffens eReportedBySlec
Dim l_p_CountAlcoho lRelated
Dim l_p_CountDrugRe lated
Dim l_p_CountOffens eCommittedByJuv enile
Dim l_p_lstMonth
Dim l_p_lstYear
l_AgencyCode = Request.Form("c boAgency")
l_OffenseCode = Request.Form("c boOffense")
l_p_CountTotalO ffenses = Request.Form("t xt_CountTotalOf fenses")
l_p_CountCleare dByArrestOrExce ptionalMeans =
Request.Form("t xt_CountCleared ByArrestOrExcep tionalMeans")
l_p_CountOffens eReportedBySlec =
Request.Form("t xt_CountOffense ReportedBySlec" )
l_p_CountAlcoho lRelated = Request.Form("t xt_CountAlcohol Related")
l_p_CountDrugRe lated = Request.Form("t xt_CountDrugRel ated")
l_p_CountOffens eCommittedByJuv enile =
Request.Form("t xt_CountOffense CommittedByJuve nile")
l_Month = Request.Form("c boMonth")
l_Year = Request.Form("c boYear")
'Now we are to build each row corresponding to each of the entry
strSQL = "INSERT INTO tblAgencyOffens eStats(Applican tIntID, AgencyID,
OffenseID, CountTotalOffen ses,
CountOfOffenses ClearedByArrest OrExceptionalMe ans,
CountOfOffenses ReportedBySLEC, CountOfAlcoholR elatedOffenses,
CountOfDrugRela tedOffenses, CountOfOffenses CommittedByJuve nile, Month, Year)
VALUES ("& ApplicantIntID & ", "& l_AgencyCode &", "& l_OffenseCode &", "&
l_p_CountTotalO ffenses &", "& l_p_CountCleare dByArrestOrExce ptionalMeans &",
"& l_p_CountOffens eReportedBySlec &", "& l_p_CountAlcoho lRelated &", "&
l_p_CountDrugRe lated &", "& l_p_CountOffens eCommittedByJuv enile &", "&
l_Month &", "& l_year &")"
Response.Write strSQL & "<br>"
conn.execute(st rSQL)
Response.Write "<br>"
Response.Write "Your record has been updated." & "<br>"
%>
<A HREF="mainentry .asp?ApplicantI ntID=<%=Applica ntIntID%>">Plea se click here
for the next submission</A>
</BODY>
</HTML>