Define and use asp:AccessDataSource

Submitted by:Jhon Brain

Date added:12 February, 2012


Below example showing how to define and use asp:AccessDataSource

Tags: access data source

Code Snippet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<script runat="server">
<html xmlns="">
<head runat="server">
<title>DataList From Access</title>
<form id="form1" runat="server">
<asp:DataList ID="DataList1" runat="server" DataSourceID="AccessDataSource1" DataKeyField="CategoryID"
RepeatColumns="3" RepeatDirection="Horizontal">
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CategoryID") %>'></asp:Label>
<td style="width: 100px">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
<td style="width: 100px">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("CategoryName") %>'></asp:Label>
<br />
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
SelectCommand="SELECT * FROM [Categories]"></asp:AccessDataSource>