Link to home
Start Free TrialLog in
Avatar of arendt73
arendt73

asked on

Error updating records on ASP submission page

I have an ASP submission page that updates the same three records every few months. I get the following error after making a submission into an Access database.

Microsoft JET Database Engine error '80040e14'

Syntax error in UPDATE statement.

/warrant/date_thankyou.asp, line 6

Here is the code:
<%
strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\warrant\db\hearingdates.mdb") & ""
set conn = server.createobject("adodb.connection")
conn.open strconn
strSQLI = "UPDATE hearingdates(date_1, date_2, date_3) values ('"& request.Form("date_1") &"', '"& request.Form("date_2") &"', '"& request.Form("date_3") &"')"
conn.execute(strSQLI)
%>

Open in new window


Any assistance with Update code is greatly appreciated. Thank you.
Avatar of Big Monty
Big Monty
Flag of United States of America image

try:

strSQLI = "UPDATE hearingdates set date_1 = '"& request.Form("date_1") &"',  date_2 = '"& request.Form("date_2") &"', date_3 = '"& request.Form("date_3") & "'"
Avatar of arendt73
arendt73

ASKER

I updated the code with the recommendation and got the following error:

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

/warrant/date_thankyou.asp, line 6
Please post your updated code
As requested, please see below. Thank you.

<%
strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\warrant\db\hearingdates.mdb") & ""
set conn = server.createobject("adodb.connection")
conn.open strconn
strSQLI = "UPDATE hearingdates set date_1 = '"& request.Form("date_1") &"',  date_2 = '"& request.Form("date_2") &"', date_3 = '"& request.Form("date_3") & "'" 
conn.execute(strSQLI)
%>

Open in new window

what data type are fields date_1, date_2, and date_3? if they are strings, and there is no values being passed into it, then you should enter in a NULL value. if it's a datetime field, I'd have to look into it more.

I guess first thing to check is to verify whether or not any data is coming over. You can do that by doing a Response.Write on your sql variable after you build it.
ASKER CERTIFIED SOLUTION
Avatar of ScotterMonkie
ScotterMonkie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial