I have recently migrated from vb6 to c#.net. Undoubtedly the power of .net framework is endless which practically offered me so many features that i don't want to switch back to vb6.Recently i m creating a small software for local market. In this project I have created a database framework that would return dataset, datareader and execute non query without much effort.Here i've been using datareader to get data from database and populate them into controls when needed. And i use insert or update query to update records into database. My question is am i utilizing the full potential of ado.net. I haven't used dataset in any way. How practical it is to use insert or update/delete query in .net instead of using dataset. or do i need to start using datasets immediately so as to utilize the power of ado.net.Plz guide me through this.
SQL queries are required in any case; with or without DataSet. The difference between DataSet and DataReader is the following:
DataSet is set of tables and realtions among the tables. DataReader is an object, allowing you to read data from database. To use a DataSet you need to use DataAdapter/TableAdapter. DataAdapter/TableAdapter is an object with 4 SqlCommands (Delete, Insert, Select, Update). These commands are used to select values from database or to update the database upon the RowState in each record. Behind the scenes each command executes it's own DataReader/DataWriter.
Using a DataReader will lead you to create your own entities. DataSet on the other side can be created from designer. Designer allows you to create tables, relations, contraints,... Drag and drop from Server Explorer might be another benefit. With DataAdpater you can create a typed DataSet upon the queries. If you're application requires import/export, you'll have to write this functionality on your own when using custom entities. With DataSet this ain't a problem, allowing you to import/export data into XML. It can also be bound to DataGridView or any other similar control. DataSet also supports one level of history, allowing you to revert to previous version of each row.
I also suggest reading this documentation:
If you feel, more should be told about DataSet, just say.
- Marked as answer by Michael Sun [MSFT]Microsoft employee, Moderator Tuesday, January 05, 2010 12:13 AM