Path reference for (say) mydb.mdb in myfile.asp ?

V

visu

Hi!
Following is the code written in myfile.asp which is available in
"www.somesite.com/visu/". The mydb.mdb is available in "visu/db/". This gives
the error report "Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified

/visu/mydb.asp, line 9 ". Kindly do help me to correct the error.
==========================================
<html>
<head>
<title>My Second ASP Page using a Database</title>
</head>
<body>
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsmydb 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
strConn="DRIVER={ Microsoft Access Driver
(*.mdb)};DSN="&Server.MapPath("/visu/Db/mydb.mdb")
adoCon.Open strConn
Set rsmydb = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments;"
rsmydb.Open strSQL, adoCon
Do While not rsmydb.EOF
Response.Write ("<br>")
Response.Write (rsmydb("Name"))
Response.Write ("<br>")
Response.Write (rsmydb("Comments"))
Response.Write ("<br>")
rsmydb.MoveNext
Loop
rsmydb.Close
Set rsmydb = Nothing
Set adoCon = Nothing
%>

</body>
</html>--
Thoughts beautiful make the whole being beautiful
 
G

G. Vaught

strConn="DRIVER={ Microsoft Access Driver
(*.mdb)};DSN="&Server.MapPath("/visu/Db/mydb.mdb")

Try changing the direction of the slashes and adding a period or double
period before the first slash, such as .\visu\Db\mydb.mdb or
...\visu\Db\mydb.mdb. You may also need to add just a period or double period
in front of what is currently there. I would try this first.

If memory serves me correctly the direction of your slashes indicates you
have a "virtual path" to the database. Virtual paths generally match what is
show under the IIS Server pathing structure. This is used when your database
may reside on an entirely different server than your .asp files.

If your database directory is within the root directory where your asp
files reside, then one period should work. If your database directory
structure is outside the root directory where the asp files reside, then you
have to keep experimenting with the path structure. Remember that the asp
files may have to jump out of one directory to your other directory and or
jump to another server directory based on your setup.



visu said:
Hi!
Following is the code written in myfile.asp which is available in
"www.somesite.com/visu/". The mydb.mdb is available in "visu/db/". This
gives
the error report "Microsoft OLE DB Provider for ODBC Drivers error
'80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified

/visu/mydb.asp, line 9 ". Kindly do help me to correct the error.
==========================================
<html>
<head>
<title>My Second ASP Page using a Database</title>
</head>
<body>
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsmydb 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
strConn="DRIVER={ Microsoft Access Driver
(*.mdb)};DSN="&Server.MapPath("/visu/Db/mydb.mdb")
adoCon.Open strConn
Set rsmydb = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments;"
rsmydb.Open strSQL, adoCon
Do While not rsmydb.EOF
Response.Write ("<br>")
Response.Write (rsmydb("Name"))
Response.Write ("<br>")
Response.Write (rsmydb("Comments"))
Response.Write ("<br>")
rsmydb.MoveNext
Loop
rsmydb.Close
Set rsmydb = Nothing
Set adoCon = Nothing
%>

</body>
</html>--
Thoughts beautiful make the whole being beautiful
 
V

visu

Hi dear
Actually, i have tried out everything whatever you've suggested but still i
dont get any result. Could you please give a pseudocode for a simple query
for accessing a .mdb file from a .asp file in the same directory of a server.
Thanks in advance
visu
--
Thoughts beautiful make the whole being beautiful


G. Vaught said:
strConn="DRIVER={ Microsoft Access Driver
(*.mdb)};DSN="&Server.MapPath("/visu/Db/mydb.mdb")

Try changing the direction of the slashes and adding a period or double
period before the first slash, such as .\visu\Db\mydb.mdb or
...\visu\Db\mydb.mdb. You may also need to add just a period or double period
in front of what is currently there. I would try this first.

If memory serves me correctly the direction of your slashes indicates you
have a "virtual path" to the database. Virtual paths generally match what is
show under the IIS Server pathing structure. This is used when your database
may reside on an entirely different server than your .asp files.

If your database directory is within the root directory where your asp
files reside, then one period should work. If your database directory
structure is outside the root directory where the asp files reside, then you
have to keep experimenting with the path structure. Remember that the asp
files may have to jump out of one directory to your other directory and or
jump to another server directory based on your setup.



visu said:
Hi!
Following is the code written in myfile.asp which is available in
"www.somesite.com/visu/". The mydb.mdb is available in "visu/db/". This
gives
the error report "Microsoft OLE DB Provider for ODBC Drivers error
'80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified

/visu/mydb.asp, line 9 ". Kindly do help me to correct the error.
==========================================
<html>
<head>
<title>My Second ASP Page using a Database</title>
</head>
<body>
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsmydb 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Set adoCon = Server.CreateObject("ADODB.Connection")
strConn="DRIVER={ Microsoft Access Driver
(*.mdb)};DSN="&Server.MapPath("/visu/Db/mydb.mdb")
adoCon.Open strConn
Set rsmydb = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments;"
rsmydb.Open strSQL, adoCon
Do While not rsmydb.EOF
Response.Write ("<br>")
Response.Write (rsmydb("Name"))
Response.Write ("<br>")
Response.Write (rsmydb("Comments"))
Response.Write ("<br>")
rsmydb.MoveNext
Loop
rsmydb.Close
Set rsmydb = Nothing
Set adoCon = Nothing
%>

</body>
</html>--
Thoughts beautiful make the whole being beautiful
 

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

Top