Results 1 to 3 of 3

Thread: Not VB ....ASP..perhaps someone uses it!

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    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.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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:
    Code:
    <%@ 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
    [email protected]
    [email protected]
    ICQ#: 51055819


  3. #3

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    Thank you...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width