ADO.NET Execute Commands .. When to use what ??

SqlDataAdapters for SqlCommand

A database on a server (example: MySql, msSql, etc) is all accessed by ADO.NET using SqlConnection objects. There are typically four tasks we can perform using SQL which are, selecting queries from database, insert, update and delete. Each having different ADO.NET SqlCommand objects to query the different statements. SqlCommands are mainly divided in two categories, SqlDataAdaptors (disconnected) and SqlDataReaders (Connected). The mostly used SqlDataAdaptors are the: Fill() command, ExecuteScalar(), and ExecuteNonQuery().  For each, an example will be displayed below along with some explanation.

Continue reading