ADO.NET 101: Data Rendering with a DataGrid Control - Displaying Data from DataReader with a DataGrid Control
(Page 2 of 7 )
The first step is to start a new web application and change the default file name of the web form to something meaningful such as DataGridExample.aspx. Following this you need to make connections to a database by inserting the control SQLConnection; then, add a command to retrieve data using the control SQLCommand. This is followed by writing appropriate code to retrieve data using the DataReader as a source of the data. To display data you add DataGrid and then call the methods of the DataGrid to port the data to the DataGrid by calling the DataBind() method after indicating that the DataGrid's DataSource is the DataReader.
Connecting to the SQL ServerVS 2003 IDE has a menu item, Server Explorer, that lists all the connections made to the various servers, including SQL 2000 Server, MSDE, MS Access, and so on. If the sources are not moved they can be refreshed by going to the connection, right clicking the node and choosing Refresh. For example, the next picture shows refreshing a connection to the MS Access Database file.

As to the SQL 2000 server, whether or not you have the correct version of the VS 2003 IDE, you will not be able to connect to a SQL Server. With a standard edition of VS 2003, you may connect only to MSDE and MS Access database servers.

Next: Connecting to a SQL Server database >>
More ASP Articles
More By Jayaram Krishnaswamy