Link to home
Start Free TrialLog in
Avatar of ralphbell
ralphbell

asked on

Microsoft VBScript runtime error '800a01a8'

I am moving a web site that is written in asp.  I can display the pages that pull info from a ms access database.  The problem I have is trying to update info in the database from a form.  I have very little asp experience.  Any help to get this working would be greatly appreciated!!

Server setup is:
Microsoft Windows Server 2003
IIS (Internet Information Server) 6.0
ASP (Active Server Pages) 3.0+
ASP.NET
CDO (Collaboration Data Objects) 1.2.1
ColdFusion MX 6.1
FrontPage 2002
Perl 5.6
CGI (Common Gateway Interface)
PHP (Personal Home Pages) 4.2.3
Python 2.3
SSI (Server Side Includes)
SSL (Secure Socket Layer)

Our .net server platform current supports the following server file types:

.asax
.ascx
.ashx
.asmx
.aspx
.axd
.config
.cs
.csprorj
.licx
.rem
.resources
.resx
.soap
.vb
.vbproj
.vsdisco
.webinfo

Our Windows platform does not currently support the following:
XML (Extensible Markup Language)

Error Message:
Microsoft VBScript runtime  error '800a01a8'
Object required: 'Provider=Microsoft.J'
/admin/listing2updX.asp, line 50

line 50 is:
           strCon.Execute(sql)
which is executing line 16
    sql=  "update list2"

below is the entire code:

<%
 Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

   rs.open "Select * from  list2  where  key=" & nokey , strCon,  3
      wpass=rs("key")
     
       if wpass <> request.form("address") then

    sql=  "update list2"
 
    sql=     sql  &   "  set  area   ='"  & request.form("area")      & "',"
    sql=     sql  &   "        county='" & Request.form("county")  & "',"
    sql=     sql  &   " address='" &request.form("address")&"',"
    sql=     sql  &   " city='" &request.form("city")&"',"
    sql=     sql  &   " state='" &request.form("state")&"',"
    sql=     sql  &   " zip='" &request.form("zip")&"',"
    sql=     sql  &   " price='" &request.form("price")&"',"
    sql=     sql  &   " mls='" &request.form("mls#")&"',"
    sql=     sql  &   " class='" &request.form("class")&"',"
    sql=     sql  &   " status='" &request.form("status")&"',"
    sql=     sql  &   " mlsarea='" &request.form("mlsarea")&"',"
    sql=     sql  &   " ele1='" &request.form("ele1")&"',"
    sql=     sql  &   " junior1='" &request.form("junior1")&"',"
    sql=     sql  &   " high1='" &request.form("high1")&"',"
    sql=     sql  &   " sqft='" &request.form("sqft")&"',"
    sql=     sql  &   "yrbuilt='" &request.form("yrbuilt")&"',"
    sql=     sql  &   " tax='" &request.form("tax")&"',"
    sql=     sql  &   " taxyear='" &request.form("taxyear")&"',"
    sql=     sql  &   " bed='" &request.form("bed")&"',"
    sql=     sql  &   " bath='" &request.form("bath")&"',"
    sql=     sql  &   " lrms='" &request.form("lrms")&"',"
    sql=     sql  &   " garage='" &request.form("garage")&"',"
    sql=     sql  &   " fplace='" &request.form("fplace")&"', "
    sql=     sql  &   " pool='" &request.form("pool")&"',"
    sql=     sql  &   " exp='" &newstr(request.form("exp"))&"',"
    sql=     sql  &   " upd='" &now&"',"
    sql=     sql  &   " input='" &request.form("city")&"',"
    sql=     sql  &   " rem='" &request.form("address")&"',"
    sql=     sql  &   " flag='" &request.form("address")&"'"
    sql =    sql  &   "  where key =" & request.querystring("lid")
     
            response.write sql
           strCon.Execute(sql)
   
 
   rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing

      response.redirect   "listingsfortest.asp"
 
 else


           response.write " <center>¨¬n©ö¨¢©ö©ªE¡Ì¡Æ¢® ¨¡©÷¢¬©ø¢¥I¢¥U. <br>"
           response.write  alert & " ¥ì©ö¨ú¨¡¡Æ¢®¨ù¨ù¢¯a......<br>"
           doc="<a href='listings.asp'>¥ì©ö¨ú¨¡¡Æ¢®¡¾a</a>"
       
           response.write doc

end if

      Function newstr(str)
      
            newstr = Replace(Replace(str,"'","''"),CHR(34),"&quot;")
      
      End function

%>
Avatar of jplevyak
jplevyak

On the line

            response.write sql
           strCon.Execute(sql)

The problem is the code is trying to execute a sql statement from a connection string variable. The Execute method needs to be called from your Connection object variable, adoCon, but make sure you open this connection using your string first:

adoCon.Open(strCon)
adoCon.Execute(sql)

Also need to fix clean up statements:

 adoCon.close
 set adoCon=nothing
Avatar of Ryan Chong
response.write sql

try add a response.end there to do debugging, like:

....

response.write sql
response.end

then check that generated sql statement and see if you missing some values there, and check the field data types make sure the values are in correct type as well.
Avatar of ralphbell

ASKER

Changed the code as per jplevyak suggestions but still get the same error:

Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
/admin/listing2updX.asp, line 52

new code is:
<%
 Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

   rs.open "Select * from  list2  where  key=" & nokey , strCon,  3
      wpass=rs("key")
     
       if wpass <> request.form("address") then

    sql=  "update list2"
 
    sql=     sql  &   "  set  area   ='"  & request.form("area")      & "',"
    sql=     sql  &   "        county='" & Request.form("county")  & "',"
    sql=     sql  &   " address='" &request.form("address")&"',"
    sql=     sql  &   " city='" &request.form("city")&"',"
    sql=     sql  &   " state='" &request.form("state")&"',"
    sql=     sql  &   " zip='" &request.form("zip")&"',"
    sql=     sql  &   " price='" &request.form("price")&"',"
    sql=     sql  &   " mls='" &request.form("mls#")&"',"
    sql=     sql  &   " class='" &request.form("class")&"',"
    sql=     sql  &   " status='" &request.form("status")&"',"
    sql=     sql  &   " mlsarea='" &request.form("mlsarea")&"',"
    sql=     sql  &   " ele1='" &request.form("ele1")&"',"
    sql=     sql  &   " junior1='" &request.form("junior1")&"',"
    sql=     sql  &   " high1='" &request.form("high1")&"',"
    sql=     sql  &   " sqft='" &request.form("sqft")&"',"
    sql=     sql  &   "yrbuilt='" &request.form("yrbuilt")&"',"
    sql=     sql  &   " tax='" &request.form("tax")&"',"
    sql=     sql  &   " taxyear='" &request.form("taxyear")&"',"
    sql=     sql  &   " bed='" &request.form("bed")&"',"
    sql=     sql  &   " bath='" &request.form("bath")&"',"
    sql=     sql  &   " lrms='" &request.form("lrms")&"',"
    sql=     sql  &   " garage='" &request.form("garage")&"',"
    sql=     sql  &   " fplace='" &request.form("fplace")&"', "
    sql=     sql  &   " pool='" &request.form("pool")&"',"
    sql=     sql  &   " exp='" &newstr(request.form("exp"))&"',"
    sql=     sql  &   " upd='" &now&"',"
    sql=     sql  &   " input='" &request.form("city")&"',"
    sql=     sql  &   " rem='" &request.form("address")&"',"
    sql=     sql  &   " flag='" &request.form("address")&"'"
    sql =    sql  &   "  where key =" & request.querystring("lid")
     
            'response.write sql
                  'response.end
                  adoCon.Open(strCon)
                  adoCon.Execute(sql)

   
   adoCon.close
   set adoCon=nothing
   rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing

      response.redirect   "listingsfortest.asp"
 
 else


           response.write " <center>¨¬n©ö¨¢©ö©ªE¡Ì¡Æ¢® ¨¡©÷¢¬©ø¢¥I¢¥U. <br>"
           response.write  alert & " ¥ì©ö¨ú¨¡¡Æ¢®¨ù¨ù¢¯a......<br>"
           doc="<a href='listings.asp'>¥ì©ö¨ú¨¡¡Æ¢®¡¾a</a>"
       
           response.write doc

end if

      Function newstr(str)
      
            newstr = Replace(Replace(str,"'","''"),CHR(34),"&quot;")
      
      End function

%>

Also added ryancys suggestion and result is:

update list2 set area ='Austin', county='travis', address='1401 N Weston Lane', city='Austin', state='TX', zip='78733', price='2995000', mls='', class='House', status='Active', mlsarea='8E', ele1='westlake', junior1='westlake', high1='westlake', sqft='7500',yrbuilt='1999', tax='23000', taxyear='2003', bed='5', bath='3.5', lrms='5', garage='3', fplace='1', pool='1', exp='This wonderful waterfront retreat boasts approximately 5400 square feet, five bedrooms; four living, three and a half bath, plus flex room and a three car garage. Situated on over a 1.34 acre lot this paradise offers an abundance of scenic charm and casual elegance. Featuring a two stall boat dock with party deck and plenty of room for pool, this waterfront estate enjoys over130 feet of pristine lapping lake frontage. zzzzzzzzzzzzzzzzz ', upd='3/28/2006 6:29:51 AM', input='Austin', rem='1401 N Weston Lane', flag='1401 N Weston Lane' where key =103

Are you able to copy and paste the above statement into Access' Query Builder to run it, and see which part is actually error? As mentioned, make sure the values submitted matched the fields data type.
ok....first.  You have this wrong Server.MapPath("/data\db1.mdb")<-=not a valid path
if this was an invalid path I would receive the following message:

Microsoft JET Database Engine error '80004005'

'\\xxxx\xxxx\xxxx\xxxx\xxxx\xx.xxxxx\xxxxx\data\db1.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

/admin/listing2updfortest.asp, line 19

xxxx replace actual directories on server.

The path is valid because the form displays the data from the database.
The post to the access data base from the Querry builder was successful on a local machine.
so seeing as how you are not willing to try it.  I will just keep my ideas to myself (even though I have made the same mistake before, and it has errored out on me)

good luck to you
I did try it...thank you for you assistance.  The host also provided me with this path Server.MapPath("/data\db1.mdb").  When changing it to either "data\db1.mdb" or "\data\db1.mdb" I get the above error.
hmmm.... I noticed that adoCon is not open, try this

replace:
<%
 Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")


with:
<%
 Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

adoCon.open strCon

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")


also replace:
 rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing

with this:

   rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing
adoCon.close
set adoCon = nothing
new code suggestion produced this error:

ADODB.Connection error '800a0e79'
Operation is not allowed when the object is open.
/admin/listing2updX.asp, line 57

changed code posted below:

<%
  Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

adoCon.open strCon

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

   rs.open "Select * from  list2  where  key=" & nokey , strCon,  3
      wpass=rs("key")
     
       if wpass <> request.form("address") then

    sql=  "update list2"
 
    sql=     sql  &   "  set  area   ='"  & request.form("area")      & "',"
    sql=     sql  &   "        county='" & Request.form("county")  & "',"
    sql=     sql  &   " address='" &request.form("address")&"',"
    sql=     sql  &   " city='" &request.form("city")&"',"
    sql=     sql  &   " state='" &request.form("state")&"',"
    sql=     sql  &   " zip='" &request.form("zip")&"',"
    sql=     sql  &   " price='" &request.form("price")&"',"
    sql=     sql  &   " mls='" &request.form("mls#")&"',"
    sql=     sql  &   " class='" &request.form("class")&"',"
    sql=     sql  &   " status='" &request.form("status")&"',"
    sql=     sql  &   " mlsarea='" &request.form("mlsarea")&"',"
    sql=     sql  &   " ele1='" &request.form("ele1")&"',"
    sql=     sql  &   " junior1='" &request.form("junior1")&"',"
    sql=     sql  &   " high1='" &request.form("high1")&"',"
    sql=     sql  &   " sqft='" &request.form("sqft")&"',"
    sql=     sql  &   "yrbuilt='" &request.form("yrbuilt")&"',"
    sql=     sql  &   " tax='" &request.form("tax")&"',"
    sql=     sql  &   " taxyear='" &request.form("taxyear")&"',"
    sql=     sql  &   " bed='" &request.form("bed")&"',"
    sql=     sql  &   " bath='" &request.form("bath")&"',"
    sql=     sql  &   " lrms='" &request.form("lrms")&"',"
    sql=     sql  &   " garage='" &request.form("garage")&"',"
    sql=     sql  &   " fplace='" &request.form("fplace")&"', "
    sql=     sql  &   " pool='" &request.form("pool")&"',"
    sql=     sql  &   " exp='" &newstr(request.form("exp"))&"',"
    sql=     sql  &   " upd='" &now&"',"
    sql=     sql  &   " input='" &request.form("city")&"',"
    sql=     sql  &   " rem='" &request.form("address")&"',"
    sql=     sql  &   " flag='" &request.form("address")&"'"
    sql =    sql  &   "  where key =" & request.querystring("lid")
     
            response.write sql
                  'response.end
                  adoCon.Open(strCon)
                  adoCon.Execute(sql)

   
  rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing
adoCon.close
set adoCon = nothing

      response.redirect   "listingsfortest.asp"
 
 else


           response.write " <center>¨¬n©ö¨¢©ö©ªE¡Ì¡Æ¢® ¨¡©÷¢¬©ø¢¥I¢¥U. <br>"
           response.write  alert & " ¥ì©ö¨ú¨¡¡Æ¢®¨ù¨ù¢¯a......<br>"
           doc="<a href='listings.asp'>¥ì©ö¨ú¨¡¡Æ¢®¡¾a</a>"
       
           response.write doc

end if

      Function newstr(str)
      
            newstr = Replace(Replace(str,"'","''"),CHR(34),"&quot;")
      
      End function

%>
you have:
nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

posted twice, so you can get rid of one of the extra ones.

also, replace:
adoCon.Open(strCon)
               adoCon.Execute(sql)
 with:
adoCon.Execute(sql)
made changes and now receive this error

Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
/admin/listing2updX.asp, line 53

code is below:

<%
  Set adoCon=Server.CreateObject("ADODB.Connection")
 'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Server.MapPath("/data\db1.mdb") & ";"

adoCon.open strCon

   nokey=request.querystring("lid")

   Set  rs=Server.CreateObject("ADODB.Recordset")

    rs.open "Select * from  list2  where  key=" & nokey , strCon,  3
      wpass=rs("key")
     
       if wpass <> request.form("address") then

    sql=  "update list2"
 
    sql=     sql  &   "  set  area   ='"  & request.form("area")      & "',"
    sql=     sql  &   "        county='" & Request.form("county")  & "',"
    sql=     sql  &   " address='" &request.form("address")&"',"
    sql=     sql  &   " city='" &request.form("city")&"',"
    sql=     sql  &   " state='" &request.form("state")&"',"
    sql=     sql  &   " zip='" &request.form("zip")&"',"
    sql=     sql  &   " price='" &request.form("price")&"',"
    sql=     sql  &   " mls='" &request.form("mls#")&"',"
    sql=     sql  &   " class='" &request.form("class")&"',"
    sql=     sql  &   " status='" &request.form("status")&"',"
    sql=     sql  &   " mlsarea='" &request.form("mlsarea")&"',"
    sql=     sql  &   " ele1='" &request.form("ele1")&"',"
    sql=     sql  &   " junior1='" &request.form("junior1")&"',"
    sql=     sql  &   " high1='" &request.form("high1")&"',"
    sql=     sql  &   " sqft='" &request.form("sqft")&"',"
    sql=     sql  &   "yrbuilt='" &request.form("yrbuilt")&"',"
    sql=     sql  &   " tax='" &request.form("tax")&"',"
    sql=     sql  &   " taxyear='" &request.form("taxyear")&"',"
    sql=     sql  &   " bed='" &request.form("bed")&"',"
    sql=     sql  &   " bath='" &request.form("bath")&"',"
    sql=     sql  &   " lrms='" &request.form("lrms")&"',"
    sql=     sql  &   " garage='" &request.form("garage")&"',"
    sql=     sql  &   " fplace='" &request.form("fplace")&"', "
    sql=     sql  &   " pool='" &request.form("pool")&"',"
    sql=     sql  &   " exp='" &newstr(request.form("exp"))&"',"
    sql=     sql  &   " upd='" &now&"',"
    sql=     sql  &   " input='" &request.form("city")&"',"
    sql=     sql  &   " rem='" &request.form("address")&"',"
    sql=     sql  &   " flag='" &request.form("address")&"'"
    sql =    sql  &   "  where key =" & request.querystring("lid")
     
           ' response.write sql
                  'response.end
                  adoCon.Execute(sql)

   
  rs.close
   set rs=nothing
   strCon.close
   set strCon=nothing
adoCon.close
set adoCon = nothing

      response.redirect   "listingsfortest.asp"
 
 else


           response.write " <center>¨¬n©ö¨¢©ö©ªE¡Ì¡Æ¢® ¨¡©÷¢¬©ø¢¥I¢¥U. <br>"
           response.write  alert & " ¥ì©ö¨ú¨¡¡Æ¢®¨ù¨ù¢¯a......<br>"
           doc="<a href='listings.asp'>¥ì©ö¨ú¨¡¡Æ¢®¡¾a</a>"
       
           response.write doc

end if

      Function newstr(str)
      
            newstr = Replace(Replace(str,"'","''"),CHR(34),"&quot;")
      
      End function

%>
ASKER CERTIFIED SOLUTION
Avatar of kevp75
kevp75
Flag of United States of America image

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
did your suggestions, here is the response

update list2 set (area ='Austin', county='', address='1401 N Weston Lane', city='Austin', state='TX', zip='78733', price='2995000', mls='', class='House', status='Active', mlsarea='', ele1='', junior1='', high1='', sqft='', yrbuilt='', tax='', taxyear='2003', bed='5', bath='3.5', lrms='', garage='3', fplace='1', pool='', exp='This wonderful waterfront retreat boasts approximately 5400 square feet, five bedrooms; four living, three and a half bath, plus flex room and a three car garage. Situated on over a 1.34 acre lot this paradise offers an abundance of scenic charm and casual elegance. Featuring a two stall boat dock with party deck and plenty of room for pool, this waterfront estate enjoys over130 feet of pristine lapping lake frontage. zzzzzzzzzzzz ', upd='3/31/2006 7:52:41 AM', input='Austin', rem='1401 N Weston Lane', flag='1401 N Weston Lane') where key =103

zzzzzzzzzzzzz is what was updated.

when I comment out the response.write sql and response.end the error is
Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
/admin/listing2updX.asp, line 53