Answer:
SqlCommand:
1) Represents a Transact-SQL statement or stored procedure to
execute against a SQL Server database.
2)It can be initalized by any T-SQL satement
3)we have to explicitly initalize SqlDataReader when we use SqlCommand
4)database connections have to be manually opened and closed.
SqlDataAdapter:
1)Represents a set of data commands and a database connection that
are used to fill the DataSet/DataTable and update a SQL Server database.
2)It can be initialized using Select command either directly in its constructor
or by assigning an object of SqlCommand containing a select statement
to its SelectCommand property.
3)SqlDataReader is internally used in SqlDataAdapter.
4)database connections are automatically opened and closed.
Asked In: Many Interviews |
Alert Moderator