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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pranay RanaRank #735 · 3.2K reputationPosted May 14, 2015, 12:51 AM EDT
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.