Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2003, 06:00 PM
aac aac is offline
Authorized User
 
Join Date: Jun 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>





Similar Threads
Thread Thread Starter Forum Replies Last Post
custome display in grid view MunishBhatia ASP.NET 2.0 Professional 5 November 16th, 2007 11:45 PM
How to display data into Grid View? Somesh ASP.NET 2.0 Professional 5 May 25th, 2007 07:07 AM
Export data from data grid to excel pomoc VB.NET 2002/2003 Basics 0 December 16th, 2005 03:11 PM
Export data from data grid to Excel pomoc Visual Basic 2005 Basics 0 December 16th, 2005 02:56 PM
trying to load db data into data grid itsajourney Beginning VB 6 2 June 7th, 2005 12:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.