Hello ASP Gurus,
Have run into a stumper lately regarding the real time updating of a MS Access database from a "Request Information" page that I have developed for a local retail boating company. Basically the page collects contact information for people interested in the vendors boats. I developed the Request Information page on my local machine at home while using Microsoft's Personal Web Server (PWS). I created a system DSN on my home computer called "webhits" and my access database was named the same. It worked like a champ on my local machine. I typed in some test data an hit the submit button and it updated the database, no problem. After some extensive testing time on my local computer, I decided that it was time to upload the page and database to my local ISP and begin collecting "Real Information". The Request Information code was patterned off of the code that I found in the SAMS book Teach Yourself ASP in 21 Days. I go through some simple edit checks first and then I perform the update. Here's the source:
<%@ Language=VBScript %>
<% Option Explicit %>
<HTML>
<meta name="site-config-URL" content="">
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
Dim objRS
Dim bolpassedits
bolpassedits = True
If (Request.Form("lastname" = "" _
Then
Response.Write "The Last Name Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("firstname" ="" _
Then
Response.Write "The First Name Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("address" ="" _
Then
Response.Write "The Address Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("city" ="" _
Then
Response.Write "The City Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("state" = "" _
Then
Response.Write "The State Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("zip" = "" _
Then
Response.Write "The Zip Code Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("email" = "" _
Then
Response.Write "The Email Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
End If
End If
End If
End If
End If
End If
End If
If bolpassedits = True Then
Const adCmdTable = &H0002
Const adLockOptimistic = 3
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open "custhits",objConn,,adLockOptimistic,adCmdTable
objRS.AddNew
objRS("last_name" = Request.form("lastname"
objRS("first_name" = Request.form("firstname"
objRS("address" = Request.form("address"
objRS("city" = Request.form("city"
objRS("state" = Request.form("state"
objRS("zip" = Request.form("zip"
objRS("phone" = Request.form("phone"
objRS("fax" = Request.form("fax"
objRS("email" = Request.form("email"
objRS("ski_boat" = Request.form("fishski"
objRS("pont_boat" = Request.form("pontoon"
objRS("deck_boat" = Request.form("deck"
objRS("offs_boat" = Request.form("off"
objRS("comments" = Request.form("comment_area"
objRS("ins_date" = Date
objRS("ins_time" = Time
objRS.Update
objRS.Close
Set objRS = Nothing
Response.Write "The Following Information Was Submitted:" & "<BR>" & "<BR>"
Response.Write "First Name: " & Request.form("firstname" & "<BR>"
Response.Write "Last Name: " & Request.form("lastname" & "<BR>"
Response.Write "Address: " & Request.form("address" & "<BR>"
Response.Write "City: " & Request.form("city" & "<BR>"
Response.Write "State: " & Request.form("state" & "<BR>"
Response.Write "Zip: " & Request.form("zip" & "<BR>"
Response.Write "Phone: " & Request.form("phone" & "<BR>"
Response.Write "Fax: " & Request.form("fax" & "<BR>"
Response.Write "Email: " & Request.form("email" & "<BR>"
Response.Write "Interest In: " & "<BR>"
Response.Write " Fishing and Ski Boats: " & Request.form("fishski" & "<BR>"
Response.Write " Pontoon Boats: " & Request.form("pontoon" & "<BR>"
Response.Write " Deck Boats: " & Request.form("deck" & "<BR>"
Response.Write " Offshore Boats: " & Request.form("off" & "<BR>"
Response.Write " Comments: " & "<BR>" & "<BR>"
Response.Write Request.form("comment_area" & "<BR>" & "<BR>"
Response.Write "Thank You, We Will Contact You Shortly " & "<BR>" & "<BR>"
Response.Write "<A HREF='../default.htm' >."
Response.Write "Return to XXXXXXXXX Boats Home Page."
Response.Write "</A>"
End If
objConn.Close
Set objConn = Nothing
%>
</BODY>
</HTML>
My problem is that it works great on my local PWS machine, but when I attempted to upload and activate it on my ISP provider (who's running a NT box with IIS) as soon as I attempt to save a record to the Access database by hitting the submit button, I get the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/pages/saveinfo.asp, line 98
One area that I'm suspicious of is the hardcoded constants for the adLockOptimistic and adCmdTable values. I hardcoded these initially because I haven't had much luck getting the includes to work, so I simply hardcoded them
Any insight or help that you can provide will be greatly appreciated.
Regards,
Mark
Have run into a stumper lately regarding the real time updating of a MS Access database from a "Request Information" page that I have developed for a local retail boating company. Basically the page collects contact information for people interested in the vendors boats. I developed the Request Information page on my local machine at home while using Microsoft's Personal Web Server (PWS). I created a system DSN on my home computer called "webhits" and my access database was named the same. It worked like a champ on my local machine. I typed in some test data an hit the submit button and it updated the database, no problem. After some extensive testing time on my local computer, I decided that it was time to upload the page and database to my local ISP and begin collecting "Real Information". The Request Information code was patterned off of the code that I found in the SAMS book Teach Yourself ASP in 21 Days. I go through some simple edit checks first and then I perform the update. Here's the source:
<%@ Language=VBScript %>
<% Option Explicit %>
<HTML>
<meta name="site-config-URL" content="">
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString="DSN=webhits"
objConn.open
Dim objRS
Dim bolpassedits
bolpassedits = True
If (Request.Form("lastname" = "" _
Then
Response.Write "The Last Name Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("firstname" ="" _
Then
Response.Write "The First Name Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("address" ="" _
Then
Response.Write "The Address Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("city" ="" _
Then
Response.Write "The City Field Cannot Be Empty" & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("state" = "" _
Then
Response.Write "The State Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("zip" = "" _
Then
Response.Write "The Zip Code Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
Else
If (Request.Form("email" = "" _
Then
Response.Write "The Email Field Cannot Be Empty." & "<BR>"
Response.Write "<A HREF='gather.htm' >."
Response.Write "Return to Request Information Screen to Correct Error."
Response.Write "</A>"
bolpassedits = False
End If
End If
End If
End If
End If
End If
End If
If bolpassedits = True Then
Const adCmdTable = &H0002
Const adLockOptimistic = 3
Set objRS=Server.CreateObject("ADODB.Recordset"
objRS.Open "custhits",objConn,,adLockOptimistic,adCmdTable
objRS.AddNew
objRS("last_name" = Request.form("lastname"
objRS("first_name" = Request.form("firstname"
objRS("address" = Request.form("address"
objRS("city" = Request.form("city"
objRS("state" = Request.form("state"
objRS("zip" = Request.form("zip"
objRS("phone" = Request.form("phone"
objRS("fax" = Request.form("fax"
objRS("email" = Request.form("email"
objRS("ski_boat" = Request.form("fishski"
objRS("pont_boat" = Request.form("pontoon"
objRS("deck_boat" = Request.form("deck"
objRS("offs_boat" = Request.form("off"
objRS("comments" = Request.form("comment_area"
objRS("ins_date" = Date
objRS("ins_time" = Time
objRS.Update
objRS.Close
Set objRS = Nothing
Response.Write "The Following Information Was Submitted:" & "<BR>" & "<BR>"
Response.Write "First Name: " & Request.form("firstname" & "<BR>"
Response.Write "Last Name: " & Request.form("lastname" & "<BR>"
Response.Write "Address: " & Request.form("address" & "<BR>"
Response.Write "City: " & Request.form("city" & "<BR>"
Response.Write "State: " & Request.form("state" & "<BR>"
Response.Write "Zip: " & Request.form("zip" & "<BR>"
Response.Write "Phone: " & Request.form("phone" & "<BR>"
Response.Write "Fax: " & Request.form("fax" & "<BR>"
Response.Write "Email: " & Request.form("email" & "<BR>"
Response.Write "Interest In: " & "<BR>"
Response.Write " Fishing and Ski Boats: " & Request.form("fishski" & "<BR>"
Response.Write " Pontoon Boats: " & Request.form("pontoon" & "<BR>"
Response.Write " Deck Boats: " & Request.form("deck" & "<BR>"
Response.Write " Offshore Boats: " & Request.form("off" & "<BR>"
Response.Write " Comments: " & "<BR>" & "<BR>"
Response.Write Request.form("comment_area" & "<BR>" & "<BR>"
Response.Write "Thank You, We Will Contact You Shortly " & "<BR>" & "<BR>"
Response.Write "<A HREF='../default.htm' >."
Response.Write "Return to XXXXXXXXX Boats Home Page."
Response.Write "</A>"
End If
objConn.Close
Set objConn = Nothing
%>
</BODY>
</HTML>
My problem is that it works great on my local PWS machine, but when I attempted to upload and activate it on my ISP provider (who's running a NT box with IIS) as soon as I attempt to save a record to the Access database by hitting the submit button, I get the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/pages/saveinfo.asp, line 98
One area that I'm suspicious of is the hardcoded constants for the adLockOptimistic and adCmdTable values. I hardcoded these initially because I haven't had much luck getting the includes to work, so I simply hardcoded them
Any insight or help that you can provide will be greatly appreciated.
Regards,
Mark