Retrieving Datasets Generically

Because you're likely to need DataSet objects as part of your applications, and the typed DataSet created by the user-interface components may be more than you need, it makes sense to provide a generic “get me a DataSet” procedure. You pass in the SQL string and the connection string, and the GetDataSet procedure does the rest.

The sample form, Products.aspx, uses DataSets in the CategoryLoad and ProductsLoad procedures. In both cases, the code is quite similar: You supply the SQL string and the connection string and then create a DataAdapter that uses this information. You call the Fill method of the DataAdapter, filling up the DataSet you need. You can have the user-interface components provided by Visual Studio ...

Get ASP.NET Developer's JumpStart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.