none
What is the usage of CommandBuilder RRS feed

  • Question

  • i found some where that

    The CommandBuilder class is used to automatically update a database according to the changes made in a DataSet.

    This class automatically registers itself as an event listener to the RowUpdating event. Whenever data inside a row changes, the object of the CommandBuilder class automatically generates an SQL statement and uses the SelectCommand property to commit the changes made in DataSet.

    OLEDB provider in .NET Framework has the OleDbCommandBuiider class; whereas, the SQL provider has the SqlCommandBuilder class.

    this is not clear This class automatically registers itself as an event listener to the RowUpdating event. Whenever data inside a row changes, the object of the CommandBuilder class automatically generates an SQL statement and uses the SelectCommand property to commit the changes made in DataSet.

    anyone can give me RowUpdating event code from where automatically command builder comit the change in db when data change in dataset. thanks

    • Moved by CoolDadTx Wednesday, December 14, 2016 3:05 PM ADO.NET related
    Wednesday, December 14, 2016 1:53 PM

Answers

  • Do not use CommandBuilder. MS has said as far back as 2003 not to use it. It was supposed to be a helper to get people onto ADO.NET but it doesn't work well.  

    So, this type should be considered deprecated and not used in any code. How it is supposed to work isn't relevant in this case. If you need to do data binding then use regular ADO.NET and DataAdapter (for a dataset).

    Michael Taylor
    http://www.michaeltaylorp3.net

    • Marked as answer by Mou_kolkata Monday, December 26, 2016 6:06 PM
    Wednesday, December 14, 2016 3:04 PM