Last post Oct 18, 2014 01:36 PM by surya kiran
Oct 18, 2014 10:06 AM|harshamrita|LINK
I am Learning ADO.net. don't understand why we use SqlCommand and SqlDataAdapter one over other even both of them does approximately same work. Both of them use to execute query. Is SqlDataAdapter is new in respect of SqlCommand?
Oct 18, 2014 11:26 AM|Siva Krishna Macha|LINK
Hope this helps.
Oct 18, 2014 11:48 AM|homertechnologies|LINK
If you learn the basics,
Everything is Objects that has properties, collections, methods. OBject is an entity that can send or receive data.
In ado.net SqlCommand is a Command Object, SqlConnection is a connection object, sqldataadapter is an filling object to fill the data.
First you need to connect using connection object, send the command using command object, the returning data is filled using dataadapter object.
Ofcourse there are many short cut methods to use command and connection together, or do it individually.
Even in your code you used sqldataadapter, dataadapter will work only by connecting with the connection object and executing the command object.
hope this helps.
Oct 18, 2014 01:36 PM|surya kiran|LINK
Sql Command :
Represents a Transact -SQL Statements or Stored Procedures to execute against sql server database.
Represents a set of data commands and database connection that are used to fill the dataset/datatable and updates a sql server database