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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft JET Database Engine error '80040e37'

Status
Not open for further replies.

TheCandyman

Technical User
Sep 9, 2002
761
US
I'm having some coding issues, i have worked on this for days, and know i'm overlooking something small. I connect to a DB and it seems to connect to it just fine. If i change the path it give an error it can't find the file, so it does map the correct path. I take the SQL line it outputs and run that directly in the DB, it pulls correctly. So it has to be with the connection, and i have double checked the file, it is there.

Code:
Set AzDA = CreateObject("ADODB.Connection")
strAzDA = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath ("/reg/Regdb/WEBDB.MDB")
AzDA.open strAzDA

Set AzDArs = Server.CreateObject("ADODB.Recordset")

SQL = "SELECT ADANum FROM Meminfo WHERE ADANum='"& EnteredAzDA &"';"
response.write SQL

AzDArs.open SQL,Conn,0,2,1

IF not AzDArs.eof THEN
.....

This is the Error
Code:
SELECT ADANum FROM Meminfo WHERE ADANum='11111111';

Microsoft JET Database Engine error '80040e37'

The Microsoft Jet database engine cannot find the input table or query 'Meminfo'. Make sure it exists and that its name is spelled correctly.

/reg/stage3.asp, line 101

Normally this just means i spelled a name wrong and it can't find that name in the DB, but here is the table in the Access DB.

Anyone have any ideas????
 
Already looked over that, it's one of the first queries from a Google search. That's why i put all the info with screen shots here.
 
You don't format your connections the same way I do, but I've noticed there are lots of different ways to do that. One thing I've never done is have a semicolon at the end of a SELECT statement. Do you get the same error when you run the page without the semicolon at the end of your select statement?
 
This line
strAzDA = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath ("/reg/Regdb/WEBDB.MDB")
appears to be missing an ampersand after .MapPath and may have a spare pair of brackets

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
You can have the semicolon at the end of a SQL statement without a problem. There should not be a problem there. Also, the Server.MapPath() function looks correct (the parentheses hold the value that is appended to the end of the path if need be) as is. That being said, have you tried to Response.Write your strAzDA variable to be certain of exactly what your connection string is reading. Based on everything I've seen, the problem usually lies when it can't find the table (or the DB?)... Try that and post back with your results...

(I am wondering if you need to use back slashes instead of forward slashes in your Server.MapPath variable, but I'm having a brain dead moment...)

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
i put this in to see the output, and also changed the slashes. Same error. I believe the slashes go like in the origial post, but since i have errors.... :)

Code:
strAzDA = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath ("\reg\Regdb\WEBDB.MDB")
response.write strAzDA

and got this
Code:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\websites\[i]website[/i]\reg\Regdb\WEBDB.MDB

I double checked the path and thats correct. I can enter that into a window on the server and it opens teh DB. Thoughts?
 
what if you go into access and do like you are gonna make a new "Query" in design mode except go in and don't pick any tables just click cancel on that dialog for picking tables... then click the little "SQL" icon in the top left corner and paste your SQL right in there an see if it runs in native access.


Another wild guess is that maybe "meminfo" is a reserved word and it needs to be in square brackets.
 
Just tried it, it works find within Access. So it's not the SQL, and it finds the file. I even asked someone else to get on the server and find that file. He gave me the same path that it lists with Server.MapPath
 
ok is there any chance that the user account that your ASP is running under does not have read/write permission to the .MDB file and the folder in which it lives?

By default this would be the IUSR_<MachineName> account.
 
the folder permissions has read/write as well as the file. I'm only doing a Select from it as shown above.
 
What if you make a new test table "Foo" and just do a SELECT * FROM Foo

hmmm i dont have any more guesses
 
The DB can't be corrupt, i have other pages that correctly pull from it right now.
 
If you have other pages that are correctly pulling from it, can you give relevant code that compares the two (one that works, one that doesn't) and that may offer some clues. Otherwise, like Sheco, I'm out of ideas...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I thought about that, but one is on one domain and the other is on another domain, same server. The DB has to stay in the other domain folder, so different folders in IIS. Parent paths are enabled.

One that works
Code:
Set conn = server.createobject("adodb.connection")
 Path = Server.Mappath("db/WEBDB.MDB")
 DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path 
 conn.Open DSNtemp
SQL = "Select * From MemInfo Where ADANum = '" & uid & "' And pwd = '" & pwd & "'"
Set RS = Conn.Execute(SQL)
[/cdoe]

[code]
Set AzDA = CreateObject("ADODB.Connection")
strAzDA = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath ("/reg/Regdb/WEBDB.MDB")
AzDA.open strAzDA

Set AzDArs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT ADANum FROM Meminfo WHERE ADANum='"& EnteredAzDA &"';"
response.write SQL

AzDArs.open SQL,Conn,0,2,1
 
Comment on the permissions: You may only be doing a read, but MS Access does magical stuff to change it's won contacts if you so much as look at it wierd, so that might count.

I still believe this to be a permissions issue. The fcat that you have several domains setup on the machine may mean that your using a differant account as the default account then the IUSR_machine account. This would also explain why your other website can hit it and youuur current one can't.

For the moment, open that file up for full control to everyone and re-run your page. If it works then you know that it is a permissions problem. If it doesn't work then we'll have to look at other possibilitities.

 
When I say "that file for everyone" I mean the database file, sorry for the lack of detail :)

 
Also Access will sometimes want to write that little "lock file" so it needs permission to the folder it lives in and not just the file itself.
 
Tarwn, you might be right on the permissions. Maybe something about jumping to another domain?? Got me, looking forward to IIS7 as it resembles Apache more. Anyways..

I'll see about putting 'Everyone' read permissions on it. I'll let you know what happens.

Sheco, Yep it made the lock file, which has permission on it as well as the folder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top