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

MS Access on the Internet 1

Status
Not open for further replies.

pcawdron

Programmer
Jun 14, 2000
109
AU
Forgive my novice ignorance. Can I place a Microsoft Access database on a web server?

Please don't misunderstand me, I realise I must use ASP to actually access the database. But can my ASP page refer to a database I have placed on a web server.

Like most people, I have 10 MB space on my ISP's server. I realise I can place an ASP page on my ISP server, but that ASP page points at a DSN on my personal computer, pointing to an Access DB on my computer, which means my computer has to be constantly connected to the Internet. I can upload the .mdb file to my ISP server, but how do I get my ASP page to point at it?

Thanks,
Peter
 
here's a snippet of code that hopefully will help you out.

Code:
strSQL = "SELECT * FROM products"

dbPath = server.mappath("myDatabase.mdb") 
dbConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath 

set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.Open dbConnect

set rs = conn.Execute(strSQL)

the important thing is the server.mappath function.
Place your database on the isp server, and use the mappath function to get the full path to your database. (eg. c:\httproot\sillyserver\files\h\myDatabase.mdb).

Using ole db you do not have to get your isp to create a dsn for you.


tada.
langan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top