dotConnect for MySQL Documentation
MySqlDataTable Class
Members  Example  See Also  Send comments on this topic.
Devart.Data.MySql Namespace : MySqlDataTable Class

Represents a single object that provides all of the functionality needed to retrieve and manipulate data from a MySQL data source.

Inheritance Hierarchy




The Devart.Data.MySql.MySqlDataTable class extends the Devart.Common.DbDataTable class to provide a single object that can be used to access and update data from a data source. Actually, Devart.Data.MySql.MySqlDataTable replaces MySqlConnection, MySqlCommand, MySqlDataAdapter, and MySqlCommandBuilder classes with all-in-one class. When a Devart.Data.MySql.MySqlDataTable object is created, the default values of its constituent parts are set to reasonable defaults, meaning that the programmer can create a single object and immediately use it to retrieve and manipulate data from a data source.

By using Devart.Data.MySql.MySqlDataTable you can avoid explicit creation of MySqlConnection and MySqlCommand objects. When appropriate form of constructor is used, these objects are created automatically when you retrieve data from a data source. It allows you to cut down the size of the written code.

Devart.Data.MySql.MySqlDataTable allows you to automate loading of subsets of data either by selecting P:Devart.Common.DbTable.StartRecord and MaxRecords properties or by using Fill or FillPage methods that support passing parameter values into the query text.

The Devart.Data.MySql.MySqlDataTable class is designed to employ both connected and disconnected data access models. It also provides functionality for asynchronous fill operations.

The Devart.Data.MySql.MySqlDataTable class can be fully adjusted at design-time. You may retrieve data at design-time from a data source by setting P:Devart.Common.DbTable.Active property to true.

For more information on advanced features of Devart.Data.MySql.MySqlDataTable please refer to topic MySqlDataTable Advanced Features.

This class supports cross-form data binding with the InterForm Technology.

Note: This class is not available in .NET Standard 1.3 compatible assembly. It is available only in the assembly for full .NET Framework and .NET Standard 2.0 compatible assemblies.

This class is available only in Professional and Developer Editions. It is not available in Standard and Mobile Editions.


This sample shows easiness of use of Devart.Data.MySql.MySqlDataTable. The sample creates a Devart.Data.MySql.MySqlDataTable object, passing it SQL query text and connection string, retrieves data from a table and modifies it. Content of the table is printed to console then. Notice that no other component needs to be created by programmer.
C#csharpCopy Code
public void UseDataTable()
  MySqlDataTable myDataTable = new MySqlDataTable("SELECT * FROM Test.Dept", 
      "User Id=root;Host=localhost;Database=Test;");
    myDataTable.FetchAll = true;
        myDataTable.Active = true;
    myDataTable.Rows[3]["DName"] = "Researches";
    Console.WriteLine(myDataTable.Update()+" rows updated.");
    foreach(DataRow myRow in myDataTable.Rows)
      foreach(DataColumn myCol in myDataTable.Columns)
    myDataTable.Active = false;
C#Visual BasicCopy Code
Public Sub UseDataTable()
  Dim myDataTable As MySqlDataTable = New MySqlDataTable("SELECT * FROM Test.Dept", _
      "User Id=root;Host=localhost;Database=Test;")
    myDataTable.FetchAll = True
        myDataTable.Active = True
    myDataTable.Rows(3)("DName") = "Researches"
    Console.WriteLine(myDataTable.Update() & " rows updated.")
    Dim myRow As DataRow
    Dim myCol As DataColumn
    For Each myRow In myDataTable.Rows
      For Each myCol In myDataTable.Columns
        Console.Write(myRow(myCol) & Chr(9))
      Next myCol
    Next myRow
    myDataTable.Active = False
  End Try
End Sub


Namespace: Devart.Data.MySql

Platforms:Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8, Windows 10, Windows Server 2012 family.

See Also