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!

Connecting to an Access database 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
here is my code:

<%
Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hospice.mdb&quot;
Set RS = Conn.Execute(&quot;SELECT Count(*) AS Recs FROM [Disciplines]&quot;)
%>

this is the error:
Microsoft JET Database Engine error '80004005'

Could not find file 'C:\NEWNT\system32\hospice.mdb'.

/asp/test.asp, line 13
------------------
The database resides on my WEB site in the /fpdb folder
I am using Front Page 2000 but I would like to write the ASP.
The error is trying to find the database on the ISP's C:drive
Waht do I need to do to make this point to my WEB site
I tried and several other variations to no avail..

TIA

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Use server.mappath --

If your db is in the same directory as your ASP page, then the syntax would simply be:

Source=server.mappath(&quot;hospice.mdb&quot;)

or if it were one level up, it would be:

Source=server.mappath(&quot;../hospice.mdb&quot;)

and so on.

That method will return the absolute path to your db, which is what you need.

:)
Paul Prewett
penny.gif
penny.gif
 
One more slight problem

here is my code now:

<%
Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & server.mappath(&quot;hospice.mdb&quot;)
Set RS = Conn.Execute(&quot;SELECT Count(*) AS Recs FROM [Disciplines]&quot;)
%>
------------------------------
I moved the database to the Hospice folder
But now I get this error
------------------------------
Microsoft JET Database Engine error '80004005'

Could not lock file.

/asp/test.asp, line 13
------------------------------
any ideas

TIA

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Is line 13 where you are trying to open the connection???

I get so aggravated with trying to use Access as a web database... *sigh* It's just not made to do it, and so you always get these obtuse error messages.

It has to do with some connection having been left open somewhere that left the database in some wierd state so that the Jet DB Engine is having a hard time getting its claws on it. At least that's my best guess.

Be sure that you are explicitly closing all connections and then setting them =nothing. This is so important when dealing with Access because it will not return itself to the proper state after you're done with it. Well, sometimes it will, and sometimes it won't... which is what's so aggravating.

Anyone else know exactly what that particular error message means????
penny.gif
penny.gif
 
Is there any way to force it closed from Telnet or something.
Or can I create a TEST page that just has the close command in it
(set xxx = nothing) DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Well, you can't do it from a test page where the set = nothing was the only thing on it -- because this is where it gets bad again. Get this.

ASP objects are &quot;stateless&quot;, meaning that after the page is finished loading, they are supposedly destroyed, right? Well, that may be true, and one thing is for sure -- and that's that you cannot reference them again (like you have asked). The bad thing, however, is that if they left your database in that wierd state, there really isn't anything you can do about it (because you can't reference them) -- at least not that I have found -- to fix the problem.

It's this exact stuff that prompted me to go to the powers that be and all but demand that we get SQL Server. These problems simply aren't an issue in an enterprise scale system. Of course, it's pricy, which is why many people just have to deal with the problems as best as they can.

I hope you can deal with the problem the same way that I did. You'll be much happier for it.

As for the telnet thing -- I have no idea, but I would seriously doubt it for the same reasons I stated above.

:)
paul
penny.gif
penny.gif
 
Thats exactly where I'm at with cost.

I have had great success with SQl server but th eISP I like in town charges $50.00 for SQL and $10 for Access

So I'll keep messing with it
Luckily they are in town and I have a rapore with them having set up several sites. So maybe they can do something for me on their end.
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
OK here is what I did as another test.

I added the northwind database and left everything default.
I let it create everything.
It does pull up the Categoies data from it just fine
So I can take a look at its ADO code and so on.

Thanks again
consider Case this closed
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top