[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Collapse]Data Binding
      Bound Mode
      Tree Generation Algorithm in the Tree List
      Virtual Mode (Dynamic Data Loading) Using Events (Tree List Level)
      Virtual Mode - Binding to a Hierarchical Business Object (Data Source Level)
      Unbound Mode
      Unbound Columns
      Posting Data to a Connected Database in ADO.NET
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Posting Data to a Connected Database in ADO.NET

When binding using ADO.NET, you typically bind a control to a DataTable containing data from a database. When you change data via the Tree List control (adding, deleting or modifying records), the changes are accumulated in the underlying DataTable. They are not automatically posted to the database. Therefore, you need to manually call dedicated methods to post the changes.

The ADO.NET data model implies using a Data Adapter object, helping you to populate a DataTable with data from the database. The Data Adapter also provides the System.Data.Common.DbDataAdapter.Update method that allows changes from the DataTable to be posted back to the database.

Before calling the Update method, make sure that the Tree List control has saved all the changes made to the currently focused node (an end-user could enter new data but forget to update the node). For this purpose, you need to call the TreeList.PostEditor and TreeList.EndCurrentEdit methods.

The following code contains the UpdateDatasource method that posts changes stored in a custom Suppliers DataTable to a database. It is assumed that a corresponding data adapter (oleDbDataAdapter1) contains appropriate Update SQL statements to modify the target table in the database

In the example, the dataSet1 object is a System.Data.DataSet instance that contains the Suppliers DataTable.

Is this topic helpful?​​​​​​​