<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<title>Binding a Data Source to a DataGrid Control</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server" src="fetchData_oledb.cs" />
<script language="C#" runat="server">
protected void Page_Load ( object src, EventArgs e ) {
string query = "SELECT ProductType, ProductCode, Productname, ProductDescription, UnitPrice FROM Products";
myGrid.DataSource = fetchReader ( query, "dbtutor" );
myGrid.DataBind ( );
}
</script>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>Binding a Data Source to a DataGrid Control</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<p>
<asp:datagrid id="myGrid" runat="server"
width=90% cellpadding=5
font-size="10pt"
enableviewstate=false>
<headerstyle backcolor="steelblue"
forecolor="beige" font-bold />
<itemstyle verticalalign="top" />
</asp:datagrid></p>
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>