<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<title>Using Views Example: Sales by Customer</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server" src="fetchData_sql.cs" />
<script runat="server">
void Page_Load ( object src, EventArgs e ) {
if ( !IsPostBack ) {
string query = "SELECT * FROM [Sales by Customer] ORDER BY Sales desc";
myGrid.DataSource = fetchReader ( query );
myGrid.DataBind ( );
}
}
</script>
<body>
<div class="header"><h2>Using Views Example: <b>Sales by Customer</b></h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<center>
<form runat="server">
<p>
<asp:datagrid id="myGrid" runat="server"
width=80% cellpadding=5 gridlines="vertical"
font-size="10pt"
alternatingitemstyle-backcolor="whitesmoke"
autogeneratecolumns=false>
<headerstyle backcolor="lightsteelblue"
font-bold height=30
horizontalalign="center" />
<columns>
<asp:boundcolumn headertext="Company Name"
datafield="Company" />
<asp:boundcolumn headertext="Address"
datafield="Address" />
<asp:boundcolumn headertext="Sales [ US$ ] "
datafield="Sales"
dataformatstring="{0:n}"
itemstyle-horizontalalign="right" />
</columns>
</asp:datagrid>
</form>
</center>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>