Advertisement
Advertisement
| 06.15.2008 at 08:29PM PDT, ID: 23487031 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: |
<%@ Page aspcompat=true Language="VB" AutoEventWireup="false" CodeFile="read_db.aspx.vb" Inherits="read_db" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
Results of a Simple Database Query
<% Dim Connect, Addresses, Query %>
<% 'Now, create a server object which will be a DNS connection %>
<% Connect = Server.CreateObject("ADODB.Connection")%>
<% 'Open the connection to the right DSN %>
<% Connect.Open("bellevue_db")%>
<% 'Form a SQL query (in this case, get everything from the mytable table) %>
<% Addresses = Connect.Execute("SELECT * From MyTable") %>
If Addresses.EOF Then _
<%Response.Write("<tr><td>No results to display.</td></tr>")%>
Do While Not Addresses.EOF
<%Response.Write("<tr><td>" & Addresses.Fields("Name") & "</td>")%>
<%Response.Write("<td>" & Addresses.Fields("age_Range") & "</td>")%>
<%Response.Write("<td>" & Addresses.Fields("salary_range") & "</td></tr>")%>
Addresses.MoveNext
Loop
%>
</table></body>
</body>
</html>
|