 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 17th, 2004, 08:39 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Connection to server help from ASP Beginning
ASP Beginning chapter 15
I am trying to use access database like in chapter 15 but do not know the syntax for changing clssfd.asp page where it connects to the database. Everything works fine on my computer but what path should I have for a server connection usually database that I have used have the following path How would I have to change this to use it with a page like clssfd.asp p669 of Active Server Pages Beginning
This is how all my other databases on the server connect to it:
set objRS = Server.CreateObject("ADODB.Recordset")
set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/al0913/db") & "\" & "databasename.mdb"
this is the code from clssfd.asp where & what would I have to change to accomplish a connection from my server?
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source= C:\al0913\db\Classified_2000.mdb"
I would greatly appreciate any help
Thanks
Anna
|
|

April 18th, 2004, 12:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You can give the path in which your .MDB file exist.
Eg: if it is in C Drive, under folder "Database"
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\Databse\YourDB.mdb"
Hope that helps.
Cheers!
-Vijay G
|
|

April 18th, 2004, 01:45 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Alternatively, you can use Server.MapPath as well, like you had in your own "old skool" connection string:
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & Server.MapPath("/Databases/Classified_2000.mdb")
This assumes that your database is located in a folder called Databases which is located in the root of your Web site.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Yellow Is The Colour by Bugge Wesseltoft (Track 3 from the album: Moving)
|
|

April 18th, 2004, 03:24 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help I kept working on it last night until it worked
This is what worked. Just in case anyone else may have the same problem when they upload to a server.
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/al0913/db") & "\" & "homework4.mdb"
If Session("isValidUser") = True and Session("PersonID") = "" Then
|
|

April 18th, 2004, 03:27 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help the mapserver path was the one that did I kept working on it last night until it worked
This is what worked. Just in case anyone else may have the same problem when they upload to a server.
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("/al0913/db") & "\" & "databasename.mdb"
If Session("isValidUser") = True and Session("PersonID") = "" Then
|
|

April 18th, 2004, 03:39 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
I think you're better off using the OleDb connection string instead. The old Access driver with the DBQ attribute is an older connection string and is generally not recommended anymore.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Smoke Blisters 3 & 4 by Sonic Youth (Track 20 from the album: Made In USA (soundtrack))
|
|
 |