Can't display data grid
I'm using the book "Beginning ASP.NET Databases using C#" and i am unable to diplay a data grid, example on pg 64, there are no error messages it just wont display, even while using the code supplied downloaded from this web site, i'm using windows 2000 proffesional with IIS 5.0, does anyone know what i'm doing wrong?
Thanks in advance
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.SqlClient" %>
<html>
<head>
<title>Beginning ASP.NET Databases Using C#: Chapter 3</title>
</head>
<body>
<h4>First Example: Listing data from the Employees table</h4>
<asp:DatGrid id="dgNameList"
Visable="true"
runat="server"
GridLines="Both"
BackColor="LightBlue"
CellPadding="5"
CellSpacing="5"
BorderWidth="2"
BorderColor="Black"
ToolTip="Includes only those employees who are at HQ" />
</asp:DataGrid>
</body>
</html>
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
String strConnection = "server=(local)\\NetSDK; database=Northwind; integrated security=true;";
SqlConnection objConnection = new SqlConnection(strConnection);
String strSQL = "SELECT FirstName, LastName, Country " + "FROM Employees";
SqlCommand objCommand = new SqlCommand(strSQL, objConnection);
objConnection.Open();
dgNameList.DataSource = objCommand.ExecuteReader();
dgNameList.DataBind();
objConnection.Close();
}
</script>
|