If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > connection problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-15-11, 18:17
macduff macduff is offline
Registered User
 
Join Date: Aug 2011
Posts: 11
connection problem

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

Code:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("C:\Inetpub\vhosts\weekdayweddings.net\httpdocs\wdw\weddingphotographers.mdb"))

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.
Code:
<%
u_search=request.form("u_search")
u_where=request.form("u_where")
if u_search = "" or u_where= "" then 
response.redirect "searchinput.asp"

end if
accessdb="weddingphotographers" 
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
   search="nothing"
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.
Reply With Quote
  #2 (permalink)  
Old 08-16-11, 20:16
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On