PDA

Click to See Complete Forum and Search --> : Not VB ....ASP..perhaps someone uses it!


HeSaidJoe
Dec 15th, 1999, 06:50 PM
This is not VB but perhaps someone knows this one?
I am trying to use ASP on my web site and the ODBC connection on their end is visualbasicway and my db is visualbasic
What code do I need to make the connection?
The page will work on my site but I haven't figured out how to make it work on the host...and YES I have ASP priviliges.

Serge
Dec 15th, 1999, 07:56 PM
You have to bare in mind that you have to have that database located on the Server. Here is a sample of how to connect to an Access database using ASP:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="My ASP Sample">
</HEAD>
<BODY>

<%


Dim cn
Dim rs

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\wwwroot\PhoneDirectory\PhoneDir.mdb;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select FirstName, LastName, Phone From Listing", cn, adOpenStatic

Dim i
Response.Write "<center><TABLE border='1'>"
Response.Write "<TR>"
Response.Write "<TD><B>First Name</TD>"
Response.Write "<TD><B>Last Name</TD>"
Response.Write "<TD><B>Phone Extention</TD>"
Response.Write "</TR>"

Do Until rs.EOF
Response.Write "<TR>"
For i = 0 To rs.Fields.Count - 1
Response.Write "<TD>" & rs(i) & "</TD>"
Next
Response.Write "</TR>"
rs.MoveNext
Loop
Response.Write "</TABLE></center>"

%>

</BODY>
</HTML>


In this small sample I'm using the PhoneList database where I'm trying to get all people to be shown in a table.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

HeSaidJoe
Dec 15th, 1999, 10:14 PM
Thank you...