Difference between Sqlcommand and Sqlcommand builder Class
Brief describe where we can use sqlcommand class and where sqlcommand builder because I think both class have the same work.
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
RanjithKumar chiguruvada133 reputationPosted Sep 18, 2012, 6:07 AM EDT
SqlCommand: SqlCommand is used to execute Query involving Select, Update, Delete operation and to Execute SQL Stored procedures
SqlCommandBuilder:SqlCommandBuilder provides the feature of reflecting the changes made to a DataSet or an instance of the SQL server data.The object of the SqlCommandBuilder acts as a listener for RowUpdating events, whenever the DataAdapter property is set.
a) SQLCommand is used to execute all kind of SQL queries like DML(Insert, update,Delete) & DDL like(Create table, drop table etc)
b)SQLCommandBuilder object is used to build & execute SQL (DML) queries like select, insert, update & delete.
SqlCommandBuilder example as follows,
DataSet ds = new DataSet();
SqlConnection cn = new SqlConnection("strSomeConnectionString");
//Autogenerate Insert, Update & Delete commands
SqlDataAdapter da = new SqlDataAdapter("Select from t_Something", cn);
SqlCommandBuilder scb = new SqlCommand(da);
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 18, 2012, 4:32 AM EDT
http://www.c-sharpcorner.com/forums/thread/150689/sqlcommandbuilder-class-in-ado-net.aspx
Rewant ChoudharyRank #4,270 · 354 reputationPosted Sep 18, 2012, 5:33 AM EDT
b)SQLCommandBuilder object is used to build & execute SQL (DML) queries like select, insert, update & delete.