Hello Senior/Friends
i want to know that which scenario we should use SqlCommand and SqlcommandBuilder
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pranay RanaPosted May 14, 2015, 4:51 AM
SqlCommandBuilder - Automatically generates single-table commands that are used to reconcile changes made to a DataSet with the associated SQL Server database. for generating query you need to create object of sqlcommand and need to attach it with SQLAdapter. IT make use of SelectCommand query to generate intsert,upate and delete query.
You can read more : https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder%28v=vs.110%29.aspx
So basic difference is SqlCommand is just object to perform sql operation for which you need to create and assign sql query but SQLCommandBuilder is object that generates insert,update and delete query using selectcommand and also listen for changes done in datatable.So commandbuilder object is helpful when you dont want to create insert,update and delete query and when you want to update your datatable/dataset just using update method.