Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011

    Unanswered: connection problem

    Can anyone please help me by pointing out why this is not working and gives a configuration error.

    set conn=Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "SELECT Photographer, Postcode FROM details", conn
    I know the database is OK and can be connected to because I use it with another code returning results from a form with user input. All this is in the same root folder. The successful code looks like this.
    if u_search = "" or u_where= "" then 
    response.redirect "searchinput.asp"
    end if
    cn="DRIVER={Microsoft Access Driver (*.mdb)};"
    cn=cn & "DBQ=" & server.mappath(accessdb)
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql = "select * from fullpups where " & u_where &" like '%%"& u_search & "%%'" 
    rs.Open sql, cn
    If  rs.eof then
    end if
    But it is of course a different kind usage. In the former I am trying to establish a connection simply to call a function that populates a table with single pieces of data. e.g. x when y=3.

    I know I am slow on understanding but any help would be appreciated.

  2. #2
    Join Date
    Nov 2003
    Christchurch, New Zealand
    Well you are using different Provider details for starters that may be causing problems.

    The other problem may be around your use of Server.MapPath. You use the MapPath method to get the physical location for a given folder/file so saying

    Server.MapPath("weddingphotos.mdb") would result in something like "C:\Projects\WeddingStuff\Photos\WeddingPhotos.mdb "

    Trying to map with a full path specified would fail due to the path/file supplied not being found in the executing path,...

    I think.... haven't played with it for a while so I could be wrong

Posting Permissions

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