Example3 ASP
Paste this code into a file and save it as example3.asp in your sample folder.
<html>
<body>
<%Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "NorthwindDSN"
Sql = "SELECT LastName, FirstName FROM Employees "
Set rst = Conn.Execute(Sql)
If rst.EOF Then
Response.Write "No employee records available"
Conn.Close
Set Conn=Nothing
Response.End
End If %>
<table border="1">
<caption align="top">Employee List from Northwind. Demo </caption>
<tr> <th>Last Name </th> <th>First Name </th> </tr>
<%Do While Not rst.EOF%>
<tr bgcolor="#00FFFF"> <td> <%=rst("LastName")%> </td> <td> <%=rst("FirstName")%> </td> </tr>
<%rst.MoveNext
Loop
Set Conn = Nothing
Set rst = Nothing %>
</table>
</body>
</html>
Go to Main Page








No comments:
Post a Comment
Comments subject to moderation before publishing.