Hi Ioan,
If you are trying to display data from an Access db in a web page hosted on IIS using
VB, here's the bare bones of creating a virtual directory, an ASP page and an ADO connection using
VB script.
1. Your IIS default web site is typically C:\Inetpub\wwwroot. Create a new virtual directory in your IIS root directory, like C:\Inetpub\wwwroot\AccessVB.
2. Use notepad to create a simple ASP page called CustomerNames.asp in the AccessVB directory:
Code:
<HTML>
<HEAD>
<TITLE>Connecting to An Access Db</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>
Using ADO in a Visual Basic Script Web Page
</H1>
<H2>Connecting to an Access Db on your local computer</H2>
<! server side script >
<%
dim cnn
dim rstCompanyName
set cnn = Server.CreateObject("ADODB.Connection")
cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Northwind.mdb"
strSQL = "SELECT CompanyName FROM Customers"
set rstCompanyName = cnn.Execute(strSQL)
do until rstCompanyName.eof
Response.Write rstCompanyName("CompanyName") %>
<BR>
<%
rstCompanyName.movenext
loop
rstCompanyName.close
set rstCompanyName = nothing
%>
<! end server side script>
</CENTER>
</BODY>
</HTML>
This page uses an ADO connection to connect to a database stored on your C: drive (C:\Northwind.mdb).
3. With the virtual directory created, the ASP page stored in the virtual directory, and a copy of the Northwind db placed on your C: drive, type the following into your browser:
http://localhost/AccessVB/CustomerNames.asp
You should see a web page that lists the names of all the customers stored in the Northwind db.
HTH,
Bob