<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
Sub Page_Load()
Dim sql As String
Dim dbcomm As OleDbCommand
Dim dbconn As OleDbConnection
Dim dbread As OleDbDataReader
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("emp.mdb"))
dbconn.Open()
sql = "select * from emp"
dbcomm = New OleDbCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
employees.DataSource = dbread
employees.DataBind()
dbread.Close()
dbconn.Close()
End Sub
</script>
<html>
<body>
<asp:Repeater id="employees" runat="server">
<HeaderTemplate>
<table border="1" width="250">
<tr>
<th>Employee Name</th>
<th>Post</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Container.DataItem("employee_name")%></td>
<td><%#Container.DataItem("post")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</body>
</html>
|
No comments:
Post a Comment