• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. ADO.NET > Querying Data

Querying Data

You will most often be trying to pull data out of your data source to display it on your ASP.NET pages. To do so, you would use a SQL Select statement. In these examples, the Northwind database is the data source and a DataReader is populated with the results of the SQL command.

DataReader

Remember, a DataReader is a forward-only group of rows of data. You can iterate through the DataReader to display its contents with the DataReader’s Read() method, and you can find many examples of that in the SDK. I’ve also read that many sources are saying that a DataReader cannot be databound to the server controls you saw in the last chapter. I have not found that to be the truth, and I stand as the shining light in the darkness of misinformation. The following is an example of a DataReader being databound to a DataGrid just like the ones you saw in Chapter 9.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint