ASP Database connectity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepaks85
    New Member
    • Aug 2006
    • 114

    ASP Database connectity

    Hi Friends,

    I am very new to ASP and trying to connect a database with Ms-Access with DSN. I have setup the DSN into my hosting account. I don't know how to connect with the database in the ASP. Here is the code I am trying to use:

    Code:
    Set oConnection = Server.CreateObject("ADODB.Connection")
    oConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    Server.MapPath("") & ";"
    oConnection.Close
    Set oConnection = Nothing
    and I am also getting a Server error which is:

    500 - Internal server error.

    There is a problem with the resource you are looking for, and it cannot be displayed.


    Please help me in this.

    Thanks

    Deepak
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by deepaks85
    500 - Internal server error.

    There is a problem with the resource you are looking for, and it cannot be displayed.
    This error is very ambiguous. You need to turn off the "friendly error messages" to find out what the real problem is.

    To get the actual error to display, try removing all code (control + x to copy it all to the clipboard for later) write a basic hello world web page and save, hit trefresh to see the hello world, then re-paste your page, save and refresh again. This should show the actual error message.

    Jared

    Comment

    • Nicodemas
      Recognized Expert New Member
      • Nov 2007
      • 164

      #3
      If you already have a DSN setup, you are using the wrong type of connection string. Try the following, substituting your DSN for my sample one.

      Code:
      set conn=Server.CreateObject("ADODB.Connection")
      conn.Provider="Microsoft.Jet.OLEDB.4.0"
      conn.Open "sample"
      
      conn.close
      set conn = nothing

      Comment

      Working...