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

Error in ASP VBScript

Status
Not open for further replies.

RussOSU

Technical User
Apr 16, 2001
93
US
I am trying to create a website that will be used to submit job requests. I have created the form and have created the asp file in which will submit the request to a database. I know the connection for the database works because another form in the site works when submitting to another table in the database. When I try to submit the data for the job I get an error stating
------------------------------------------------------------

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/MAIRequests/additem.asp, line 42

------------------------------------------------------------
The code for this page is below
------------------------------------------------------------

<!--#include file=&quot;maireq.asp&quot;-->
<%
Dim rsRequest
Dim blnNew
Set rsRequest = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsRequest.Open &quot;maireq&quot;, objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
If Request.Form(&quot;Delete&quot;) <> &quot;&quot; Then
rsRequest.Filter = &quot;RequestID = &quot; & Request(&quot;RequestID&quot;)
If Not rsRequest.EOF Then rsRequest.Delete
Else
If Request(&quot;RequestID&quot;) = &quot;&quot; Then
blnNew = True
rsRequest.AddNew
Else
rsRequest.Filter = &quot;RequestID = &quot; & Request(&quot;RequestID&quot;)
blnNew = False
End If
rsRequest(&quot;RType&quot;) = Request.Form(&quot;RType&quot;)
rsRequest(&quot;ProdFam&quot;) = Request.Form(&quot;ProdFam&quot;)
rsRequest(&quot;ProdCode&quot;) = Request.Form(&quot;ProdCode&quot;)
rsRequest(&quot;AA#&quot;) = Request.Form(&quot;AA#&quot;)
rsRequest(&quot;PBA#&quot;) = Request.Form(&quot;PBA#&quot;)
rsRequest(&quot;WO#&quot;) = Request.Form(&quot;WO#&quot;)
rsRequest(&quot;Quan&quot;) = Request.Form(&quot;Quan&quot;)
rsRequest(&quot;Prebldst&quot;) = Request.Form(&quot;Prebldst&quot;)
rsRequest(&quot;BOMRdy&quot;) = Request.Form(&quot;BOMRdy&quot;)
rsRequest(&quot;BIOS&quot;) = Request.Form(&quot;BIOS&quot;)
rsRequest(&quot;EEPROM&quot;) = Request.Form(&quot;EEPROM&quot;)
rsRequest(&quot;Tststrat&quot;) = Request.Form(&quot;Tststrat&quot;)
rsRequest(&quot;BldType&quot;) = Request.Form(&quot;BldType&quot;)
rsRequest(&quot;BrdType&quot;) = Request.Form(&quot;BrdType&quot;)
rsRequest(&quot;PrgObj&quot;) = Request.Form(&quot;PrgObj&quot;)
rsRequest(&quot;BldHiLt&quot;) = Request.Form(&quot;BldHiLt&quot;)
rsRequest(&quot;StenMid#&quot;) = Request.Form(&quot;StenMid#&quot;)
rsRequest(&quot;BrdRot&quot;) = Request.Form(&quot;BrdRot&quot;)
rsRequest(&quot;WavMID#&quot;) = Request.Form(&quot;WavMID#&quot;)
rsRequest(&quot;WavIn#&quot;) = Request.Form(&quot;WavIn#&quot;)
rsRequest(&quot;WavRot&quot;) = Request.Form(&quot;WavRot&quot;)
rsRequest(&quot;BrdPath&quot;) = Request.Form(&quot;BrdPath&quot;)
rsRequest(&quot;WWID&quot;) = Session(&quot;WWID&quot;)
rsRequest(&quot;Status&quot;) = &quot;Active&quot;
LINE 42 ---> rsRequest.Update

If blnNew Then
Dim rsRequester
Set rsRequester = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsRequester.Open &quot;User&quot;, objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
rsRequester.Filter = &quot;WWID = &quot; & Session(&quot;WWID&quot;)
If rsRequester.EOF Then
rsRequester.AddNew
rsRequester(&quot;WWID&quot;) = Session(&quot;WWID&quot;)
rsRequester(&quot;ItemsRequested&quot;) = 0
rsRequester(&quot;ItemsActive&quot;) = 0
End If
rsRequester(&quot;ItemsRequested&quot;) = rsRequester(&quot;ItemsRequested&quot;) + 1
rsRequester(&quot;ItemsActive&quot;) = rsRequester(&quot;ItemsActive&quot;) + 1
rsRequester(&quot;LastActivity&quot;) = Now
rsRequester.Update
rsRequester.Close
Set rsRequester = Nothing
End If
End If
rsRequest.Close
Set rsRequest = Nothing

Response.Redirect &quot;MyRequests.asp&quot;
%>
------------------------------------------------------------

I am a newbie to VBScript and to asp so if you could help me out with what concept I am missing along with the fix it would be greatly appreciated. However if you only have time to write the fix that is fine.

Thanks
Russ
 


RussDog,

Usually that means you may have an apostrophe or a string with no value or trying to insert a string into a integer field. Another cause might be spaces in a string that is not quoted correctly.

Hope that helps

fengshui1998
 
Thanks fengshui1998,

The only thing that I can figure out is that my RequestID defining is wrong. RequestID is an auto# in the access database and I don't know how to handle that in my scripting. Anyone that has an idea please help.

Thanks
Russ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top