Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database connections (msAccess) Dosn't Work 1

Status
Not open for further replies.

JimFlower

Programmer
Jun 21, 2001
42
GB
Below is the code I'm trying to use followed by the results

Code:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME=&quot;Generator&quot; CONTENT=&quot;EditPlus&quot;>
<META NAME=&quot;Author&quot; CONTENT=&quot;&quot;>
<META NAME=&quot;Keywords&quot; CONTENT=&quot;&quot;>
<META NAME=&quot;Description&quot; CONTENT=&quot;&quot;>
</HEAD>

<BODY>
<%

function GetStartHours(CustomerNo)
dim db
response.write &quot;Start&quot;
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)

response.write &quot;Connect&quot;
Conn.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & _
Server.MapPath(&quot;\fpdb\extranet.mdb&quot;) & &quot;;PWD=&quot;
response.write &quot;Finnished Conecting&quot;



set rst = db.Execute(&quot;SELECT Customers.CustomerNo, Customers.StartingHours FROM Customers WHERE (((Customers.CustomerNo)=&quot; & CustomerNo & &quot;));&quot;)

select case rst.eof
case true
GetStartHours = 0
case false
rst.movefirst
GetStartHours = rst.StartingHours
end select

end function
function StripDomain(strLogonUser)
strLogonUser = Replace(strLogonUser,&quot;/&quot;,&quot;\&quot;)
StripDomain = Right(strLogonUser, (Len(strLogonUser) - inStrRev(strLogonUser, &quot;\&quot;, -1,vbTextCompare)))
end function

if request(&quot;LOGON_USER&quot;) = &quot;&quot; Then
response.clear
response.Status = &quot;401 Unauthorized&quot;
end if
MyUser = StripDomain(Request.ServerVariables(&quot;Logon_User&quot;))
response.write &quot;Start Hours = &quot; & GetStartHours(MyUser)
%>
</BODY>
</HTML>

Results:
StartConnect
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.

/dbdemo/ConnTest.asp, line 19

 
This error typically indicates the DBQ argument is invalid. You may want to write out the result of the mappath to ensure it's equating what you think it is:

Response.Write Server.MapPath(&quot;\fpdb\extranet.mdb&quot;)

You can also test this by hard coding in the path to the database:

&quot;DBQ=C:\InetPubs\fpdb\extranet.mdb&quot; Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top