I cannot find my database using oledbConnection

C

COHENMARVIN

I put the following code in my asp.net page:
dbPath = MapPath("/FBDB/db1_newport2003.mdb")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnect = strConnect & "Data Source=" & dbpath & ";"

objConnect = new OleDbConnection(strConnect)
=============================
but I get the following error:

<b>* Error while updating original data</b>.<br
/>:'D:\hshome\merctvl\mercurytravelgroup.com\FBDB\db1_newport2003.mdb'
is not a valid path. Make sure that the path name is spelled correctly
and that you are connected to the server on which the file resides.<br
/>Microsoft JET Database Engine

How can the path be invalid? The path was produced by the function
MapPath, so it must be valid!
-- Marvin
 
S

Scott M.

Well, 'D:\hshome\merctvl\mercurytravelgroup.com\FBDB\db1_newport2003.mdb'
isn't any path I've ever seen. The portion of the path
"mercurytravelgroup.com" sounds more like a URL than a file path. The
easiest thing to do is to go and actaully look at the physical path to your
database and see if it is EXACTLY what you post here.

The problem could be stemming from your leading forward-slash in the mapPath
argument. If FBDB is a child directory of the current application folder,
you should NOT be using a leading forward-slash (/) in front of it. If FBDB
is an immediate child of the virtual directory's root, then you need the
forward-slash. In other word, MapPath takes a relative path and you may
have expressed that incorrectly.

Also, are you using MS FrontPage? I ask because FrontPage creates an "FPDB"
folder for your databases, not a "FBDB" folder. If you are using FrontPage,
are you sure you haven't mistakenly written a "B" instead of a "P"?
 
C

COHENMARVIN

Thank you Scott. The problem was that I misspelt the FPDB directory as
FBDB. Apparently the asp.net MAPPATH statement will accept a directory
such as /FBDB even when that directory does not exist. I am still
having problems getting the page to work, now it says:
"Error while updating original data</b>.<br />:The INSERT INTO
statement contains the following unknown field name:
'"ADULT1_FIRSTNAME"'. Make sure you have typed the name correctly, and
try the operation again.<br />Microsoft JET Database Engine"
I looked at the database, and it definitely has the field name in it.
Also, the code used to work when it was plain ASP.
Anyway, thanks for getting me past hurdle #1.
-- Marvin
 
S

Scott M.

All I can say is that this message is generally pretty clear in that it
can't find a field with the name you specify. Are you sure you are
accessing the correct database and/or the correct table?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top