Results 1 to 3 of 3

Thread: Connect Code

  1. #1
    Join Date
    Nov 2003
    Location
    Philadelphia
    Posts
    9

    Unanswered: Connect Code

    <%
    dim DbPath, ConnStr, myConn
    DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source=" & Server.MapPath("../database/web.mdb")
    MyConn.Open ConnStr <--- line 149

    sqlName = "SELECT * FROM Table_Name"

    set rsName= Server.CreateObject("ADODB.RecordSet")
    rsName.Open sqlName, myConn

    rsName.Close
    set rsName = nothing

    MyConn.Close
    %>

    Can you guys please help me out. I am getting this error:

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /Webproject/index.asp, line 149

    I have been working on this for soo long, I have been having trouble conecting to the database, if there is other code that would be easier, please let me know. Thank you.

  2. #2
    Join Date
    Nov 2003
    Location
    Philadelphia
    Posts
    9

    Re: Connect Code

    OK seems like I forgot to add Server.CreateObject("ADODB.Connection"). After I did that I get an unusual error.

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

    /WebProject/index.asp, line 149

    Here is my code:

    <%
    dim DbPath, MyConn
    DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
    Set MyConn = Server.CreateObject("ADODB.Connection")
    MyConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("/database/web.mdb") <---line 149

    sqlName = "SELECT * FROM Table_Name"

    set rsName= Server.CreateObject("ADODB.RecordSet")
    rsName.Open sqlName, myConn

    rsName.Close
    set rsName = nothing

    MyConn.Close
    %>





    Originally posted by Shashant
    <%
    dim DbPath, ConnStr, myConn
    DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source=" & Server.MapPath("../database/web.mdb")
    MyConn.Open ConnStr <--- line 149

    sqlName = "SELECT * FROM Table_Name"

    set rsName= Server.CreateObject("ADODB.RecordSet")
    rsName.Open sqlName, myConn

    rsName.Close
    set rsName = nothing

    MyConn.Close
    %>

    Can you guys please help me out. I am getting this error:

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /Webproject/index.asp, line 149

    I have been working on this for soo long, I have been having trouble conecting to the database, if there is other code that would be easier, please let me know. Thank you.

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    Where is your database folder? I think the problem may occur in the code Server.MapPath("/database/web.mdb"). You can put the physical directory on the server instead of using Server.MapPath("/database/web.mdb").

    The following link may be helpful for you to use the function.

    http://msdn.microsoft.com/library/de...om_serommp.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •