Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]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
      Virtual Mode by Binding to a Business Object
      Unbound Mode
      Unbound Columns
      Posting Data to a Connected Database in ADO.NET
    [Expand]Nodes
    [Expand]Data Editing
    [Expand]Data Representation
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Summaries
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
    [Expand]Miscellaneous
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

How would you rate this topic?​​​​​​​