Microsoft JET Database Engine error '80040e37'


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Microsoft JET Database Engine error '80040e37'

  1. #1
    Yogesh Guest

    Microsoft JET Database Engine error '80040e37'


    I had created a file called as openconn.asp to create connections.I am including
    that page in every page so that I dont have to write code for connection
    in every page. IT is opening Connection correctly. in index.asp page i
    have opened a recordset. But recordset is throwing error. If i give only
    table name it says "Invali sql Statement" and something that it needs valid
    sql query like Insert, Update, Delete or Select. SO I had created a sekect
    SQL query as "Select * from Usr", but now it shows error messege -
    Microsoft JET Database Engine error '80040e37' or -2147217865

    The Microsoft Jet database engine cannot find the input table or query 'Usr'.
    Make sure it exists and that its name is spelled correctly.

    /ya/Index.asp, line 25

    I am enclosing the code for both openconn.asp and Index.asp pages. One more
    thing I had asked web server admin to give write privileges on directory
    Database. So that the fil is also not read only. Also I have removed Object
    tags and using ADO connection string as suggested by you. Now why is this
    new error coming up.


    Code in Index.asp
    *******************************

    <%@ Language=VBScript %>

    <!--#include file="openconn.asp" -->

    <html>
    <head>
    <title> Patient History System </title>
    <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </head>
    <%

    Dim uid,pwd

    uid = Request.Form ("userid")
    pwd = Request.Form ("password")
    IF Rs.STATE = 1 THEN
    Rs.CLOSE()
    END IF

    Rs.ActiveConnection = dbObj
    Rs.CursorType = adOpenKeySet
    Rs.LockType = adLockOptimistic
    Rs.Source = "select * from usr"
    Rs.Open

    Response.Write "RS Stare" & RS.State


    *******************************

    Code in Connopen.asp
    *******************************
    <%'connection to admin.mdb
    Dim dbObj, RS, RSOther
    set dbObj = server.createobject("ADODB.connection")
    set RS = server.createobject("ADODB.Recordset")
    set RSOther = server.createobject("ADODB.Recordset")
    curdir= server.mappath("/jurix/database/admin.mdb")

    set dbobj = server.CreateObject("ADODB.Connection")


    dbObj.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & curdir &";Persist
    Security Info=False"
    %>

    ******************************************

    i Tried by including adovbs.inc file but still it gives the same error.

    I even tried -
    Rs.ActiveConnection = dbObj
    Rs.CursorType = adOpenKeySet
    Rs.LockType = adLockOptimistic
    Rs.Open "Usr",dbObj,3,1

    but here Locktype gives error. ALso if i comment the above statement it gives
    error Usr is not a valid table name even though that table is existing in
    database


    Can you please help me to solve this.

    Thanks And Regards

    Yogesh

  2. #2
    Harish Kumar Guest

    Re: Microsoft JET Database Engine error '80040e37'


    Yogesh,

    First things first. I think the way in which you're handling the recordset
    object is wrong.

    In Connopen.asp, do not instantiate Recordset object there. Just open the
    Connection object like -

    <%
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open("<Connection String>")
    %>

    And in other Pages, include this file and instantiate Recordset object like
    -

    <!--#include file = "Connopen.asp"-->
    <%
    dim objRs, stat
    Set objRs = Server.CreateObject("ADODB.Recordset")
    stat = "select * from <table name>"
    objRs.open(stat),objConn
    ......
    ......
    'Always remember to kill both Recordset &
    'Connection Object after you're thru
    objRs.close
    objConn.close
    Set objConn=nothing
    %>

    Now, coming back to your "80040e37" error - generally this error message
    pops up if there was no corresponding table name or if the table name was
    mis-spelt. In your case, I suspect the connection string. Do one thing.
    Create an UDL file and then copy the connection string from there and paste
    in your Connopen.asp file.

    For creating the UDL file, please follow this -

    1. Go to Desk top
    2. Right click and click on New File
    3. Select Text File. Now you can see a Text file in your desk top
    4. Save the text file with UDL extension. For ex - "Test.UDL"
    5. Open the UDL file and select Provider Tab
    6. Select the appropriate OLE DB Provider
    7. Go to the Connection Tab and select the Database
    8. After testing the connection, save and come out
    9. Now Open that UDL file using Notepad (Right click on the icon and say

    Open with and select Note pad)
    10.Now you can see the connection string. Just copy and paste it into
    your file

    HTH,
    Harish

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center