ASP.Net/ADO.net Database/AccessDataSource
Define and use asp:AccessDataSource
<source lang="csharp">
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title>DataList From Access</title>
</head> <body>
<form id="form1" runat="server"> <asp:DataList ID="DataList1" runat="server" DataSourceID="AccessDataSource1" DataKeyField="CategoryID" RepeatColumns="3" RepeatDirection="Horizontal"> <ItemTemplate>
<asp:Label ID="Label1" runat="server" Text="<%# Eval("CategoryID") %>"></asp:Label> |
|
<asp:Label ID="Label2" runat="server" Text="<%# Eval("Description") %>"></asp:Label> |
<asp:Label ID="Label3" runat="server" Text="<%# Eval("CategoryName") %>"></asp:Label> |
</ItemTemplate> </asp:DataList> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="Northwind.mdb" SelectCommand="SELECT * FROM [Categories]"></asp:AccessDataSource> </form>
</body> </html>
</source>
<A href="http://www.nfex.ru/Code/ASPDownload/Northwind.zip">Northwind.zip( 736 k)</a>