Wednesday, July 05, 2006

ADO with ASP

You may use the following:

I have created a system DSN called 'ForAsp' for your illustration
I have an IIS Server on my machine
I have this page in my root directory:
---------------
<%@ Language=vbscript %>
<html>
<head><title></title></head>


<body>
<%
dim conn
set conn=Server.CreateObject("ADODB.Connection")
conn.open "DSN=ForAsp", "sa", "xxxxxxx"
dim rs
set rs=Server.CreateObject("ADODB.Recordset")
dim sql
sql="Select * from Employees"
rs.open sql, conn
do while not rs.eof
response.write(rs("LastName") & "<Br>")
rs.MoveNext
loop
rs.close
conn.close

%>
</body></html>
--------------------------------------
I call this file, hodentek.asp
When I browse this file on the local server using this http://localhost/hodentek.asp
I will see one line each, all the last names of employees in the Northwind's Employee table.
This should give some ideas to you.
Hope this helps.
sincerely,
Jay

No comments:

DMCA.com Protection Status