Class MySqlDataAdapter
Represents a set of data commands and a database connection that are used to fill a dataset and update a MySQL database. This class cannot be inherited.
Inheritance
Implements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
public sealed class MySqlDataAdapter : DbDataAdapter, IComponent, IDisposable, ICloneable, IDbDataAdapter, IDataAdapter
Remarks
The MySqlDataAdapter, serves as a bridge between a System.Data.DataSet and MySQL for retrieving and saving data. The MySqlDataAdapter provides this bridge by mapping System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet), which changes the data in the System.Data.DataSet to match the data in the data source, and System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), which changes the data in the data source to match the data in the System.Data.DataSet, using the appropriate SQL statements against the data source.
When the MySqlDataAdapter fills a System.Data.DataSet, it will create the necessary tables and columns for the returned data if they do not already exist. However, primary key information will not be included in the implicitly created schema unless the System.Data.MissingSchemaAction property is set to System.Data.MissingSchemaAction.AddWithKey. You may also have the MySqlDataAdapter create the schema of the System.Data.DataSet, including primary key information, before filling it with data using System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType).
MySqlDataAdapter is used in conjunction with MySqlConnection and MySqlCommand to increase performance when connecting to a MySQL database.
The MySqlDataAdapter also includes the SelectCommand, InsertCommand, DeleteCommand, UpdateCommand, and System.Data.Common.DataAdapter.TableMappings properties to facilitate the loading and updating of data.
When an instance of MySqlDataAdapter is created, the read/write properties are set to initial values. For a list of these values, see the MySqlDataAdapter constructor.
note
Please be aware that the System.Data.DataColumn class allows only Int16, Int32, and Int64 to have the AutoIncrement property set. If you plan to use autoincremement columns with MySQL, you should consider using signed integer columns.
Examples
The following example creates a MySqlCommand and a MySqlConnection. The MySqlConnection is opened and set as the Connection for the MySqlCommand. The example then calls ExecuteNonQuery(), and closes the connection. To accomplish this, the ExecuteNonQuery() is passed a connection string and a query string that is a SQL INSERT statement.
public DataSet SelectRows(DataSet dataset,string connection,string query)
{
MySqlConnection conn = new MySqlConnection(connection);
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand(query, conn);
adapter.Fill(dataset);
return dataset;
}
Constructors
MySqlDataAdapter()
Initializes a new instance of the MySqlDataAdapter class.
Declaration
public MySqlDataAdapter()
Remarks
When an instance of MySqlDataAdapter is created, the following read/write properties are set to the following initial values.
Properties | Initial Value |
---|---|
System.Data.MissingMappingAction | System.Data.MissingMappingAction.Passthrough |
System.Data.MissingSchemaAction | System.Data.MissingSchemaAction.Add |
You can change the value of any of these properties through a separate call to the property.
MySqlDataAdapter(MySqlCommand)
Initializes a new instance of the MySqlDataAdapter class with the specified MySqlCommand as the SelectCommand property.
Declaration
public MySqlDataAdapter(MySqlCommand selectCommand)
Parameters
Type | Name | Description |
---|---|---|
MySqlCommand | selectCommand | MySqlCommand that is a SQL SELECT statement or stored procedure and is set as the SelectCommand property of the MySqlDataAdapter. |
MySqlDataAdapter(String, MySqlConnection)
Initializes a new instance of the MySqlDataAdapter class with a SelectCommand and a MySqlConnection object.
Declaration
public MySqlDataAdapter(string selectCommandText, MySqlConnection connection)
Parameters
Type | Name | Description |
---|---|---|
System.String | selectCommandText | A String that is a SQL SELECT statement or stored procedure to be used by the SelectCommand property of the MySqlDataAdapter. |
MySqlConnection | connection | A MySqlConnection that represents the connection. |
Remarks
This implementation of the MySqlDataAdapter opens and closes a MySqlConnection if it is not already open. This can be useful in a an application that must call the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet) method for two or more MySqlDataAdapter objects. If the MySqlConnection is already open, you must explicitly call Close() or Dispose() to close it.
MySqlDataAdapter(String, String)
Initializes a new instance of the MySqlDataAdapter class with a SelectCommand and a connection string.
Declaration
public MySqlDataAdapter(string selectCommandText, string selectConnString)
Parameters
Type | Name | Description |
---|---|---|
System.String | selectCommandText | A System.String that is a SQL SELECT statement or stored procedure to be used by the SelectCommand property of the MySqlDataAdapter. |
System.String | selectConnString | The connection string |
Properties
DeleteCommand
Gets or sets a SQL statement or stored procedure used to delete records from the data set.
Declaration
public MySqlCommand DeleteCommand { get; set; }
Property Value
Type | Description |
---|---|
MySqlCommand | A MySqlCommand used during System.Data.Common.DbDataAdapter.Update(System.Data.DataSet) to delete records in the database that correspond to deleted rows in the System.Data.DataSet. |
Remarks
During System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), if this property is not set and primary key information is present in the System.Data.DataSet, the DeleteCommand can be generated automatically if you set the SelectCommand property and use the MySqlCommandBuilder. Then, any additional commands that you do not set are generated by the MySqlCommandBuilder. This generation logic requires key column information to be present in the System.Data.DataSet.
When DeleteCommand is assigned to a previously created MySqlCommand, the MySqlCommand is not cloned. The DeleteCommand maintains a reference to the previously created MySqlCommand object.
InsertCommand
Gets or sets a SQL statement or stored procedure used to insert records into the data set.
Declaration
public MySqlCommand InsertCommand { get; set; }
Property Value
Type | Description |
---|---|
MySqlCommand | A MySqlCommand used during System.Data.Common.DbDataAdapter.Update(System.Data.DataSet) to insert records into the database that correspond to new rows in the System.Data.DataSet. |
Remarks
During System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), if this property is not set and primary key information is present in the System.Data.DataSet, the InsertCommand can be generated automatically if you set the SelectCommand property and use the MySqlCommandBuilder. Then, any additional commands that you do not set are generated by the MySqlCommandBuilder. This generation logic requires key column information to be present in the DataSet.
When InsertCommand is assigned to a previously created MySqlCommand, the MySqlCommand is not cloned. The InsertCommand maintains a reference to the previously created MySqlCommand object.
note
If execution of this command returns rows, these rows may be added to the DataSet depending on how you set the UpdatedRowSource property of the MySqlCommand object.
SelectCommand
Gets or sets a SQL statement or stored procedure used to select records in the data source.
Declaration
public MySqlCommand SelectCommand { get; set; }
Property Value
Type | Description |
---|---|
MySqlCommand | A MySqlCommand used during System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet) to select records from the database for placement in the System.Data.DataSet. |
Remarks
When SelectCommand is assigned to a previously created MySqlCommand, the MySqlCommand is not cloned. The SelectCommand maintains a reference to the previously created MySqlCommand object.
If the SelectCommand does not return any rows, no tables are added to the System.Data.DataSet, and no exception is raised.
UpdateBatchSize
Gets or sets a value that enables or disables batch processing support, and specifies the number of commands that can be executed in a batch.
Declaration
public override int UpdateBatchSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
Remarks
Returns the number of rows to process for each batch.
Value is | Effect |
---|---|
0 | There is no limit on the batch size. |
1 | Disables batch updating. |
> 1 | Changes are sent using batches of UpdateBatchSize operations at a time. |
When setting this to a value other than 1, all the commands associated with the MySqlDataAdapter must have their System.Data.UpdateRowSource property set to None or OutputParameters. An exception will be thrown otherwise.
UpdateCommand
Gets or sets a SQL statement or stored procedure used to updated records in the data source.
Declaration
public MySqlCommand UpdateCommand { get; set; }
Property Value
Type | Description |
---|---|
MySqlCommand | A MySqlCommand used during System.Data.Common.DbDataAdapter.Update(System.Data.DataSet) to update records in the database with data from the System.Data.DataSet. |
Remarks
During System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), if this property is not set and primary key information is present in the System.Data.DataSet, the UpdateCommand can be generated automatically if you set the SelectCommand property and use the MySqlCommandBuilder. Then, any additional commands that you do not set are generated by the MySqlCommandBuilder. This generation logic requires key column information to be present in the DataSet.
When UpdateCommand is assigned to a previously created MySqlCommand, the MySqlCommand is not cloned. The UpdateCommand maintains a reference to the previously created MySqlCommand object.
note
If execution of this command returns rows, these rows may be merged with the DataSet depending on how you set the UpdatedRowSource property of the MySqlCommand object.
Methods
AddToBatch(IDbCommand)
Adds a System.Data.IDbCommand to the current batch.
Declaration
protected override int AddToBatch(IDbCommand command)
Parameters
Type | Name | Description |
---|---|---|
System.Data.IDbCommand | command | The System.Data.IDbCommand to add to the batch. |
Returns
Type | Description |
---|---|
System.Int32 | The number of commands in the batch before adding the System.Data.IDbCommand. |
Overrides
ClearBatch()
Removes all System.Data.IDbCommand objects from the batch.
Declaration
protected override void ClearBatch()
Overrides
CreateRowUpdatedEvent(DataRow, IDbCommand, StatementType, DataTableMapping)
Overridden. See System.Data.Common.DbDataAdapter.CreateRowUpdatedEvent(System.Data.DataRow, System.Data.IDbCommand, System.Data.StatementType, System.Data.Common.DataTableMapping).
Declaration
protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow | dataRow | |
System.Data.IDbCommand | command | |
System.Data.StatementType | statementType | |
System.Data.Common.DataTableMapping | tableMapping |
Returns
Type | Description |
---|---|
System.Data.Common.RowUpdatedEventArgs |
Overrides
CreateRowUpdatingEvent(DataRow, IDbCommand, StatementType, DataTableMapping)
Initializes a new instance of the System.Data.Common.RowUpdatingEventArgs class.
Declaration
protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow | dataRow | The System.Data.DataRow that updates the data source. |
System.Data.IDbCommand | command | The System.Data.IDbCommand to execute during the System.Data.IDataAdapter.Update(System.Data.DataSet). |
System.Data.StatementType | statementType | Whether the command is an UPDATE, INSERT, DELETE, or SELECT statement. |
System.Data.Common.DataTableMapping | tableMapping | A System.Data.Common.DataTableMapping object. |
Returns
Type | Description |
---|---|
System.Data.Common.RowUpdatingEventArgs |
Overrides
ExecuteBatch()
Executes the current batch.
Declaration
protected override int ExecuteBatch()
Returns
Type | Description |
---|---|
System.Int32 | The return value from the last command in the batch. |
Overrides
FillAsync(DataSet)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet) method.
Declaration
public Task<int> FillAsync(DataSet dataSet)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill records with. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, Int32, Int32, String)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, int startRecord, int maxRecords, string srcTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.String | srcTable | The name of the source table to use for table mapping. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, Int32, Int32, String, IDbCommand, CommandBehavior)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataSet, Int32, Int32, String, IDbCommand, CommandBehavior, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataSet, Int32, Int32, String, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, int startRecord, int maxRecords, string srcTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, String)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, string srcTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.String | srcTable | The name of the source table to use for table mapping. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, String, IDataReader, Int32, Int32)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Data.IDataReader | dataReader | An instance of System.Data.IDataReader. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, String, IDataReader, Int32, Int32, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.Int32, System.Int32, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Data.IDataReader | dataReader | An instance of System.Data.IDataReader. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, String, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet, System.String) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, string srcTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill with records. |
System.String | srcTable | The name of the source table to use for table mapping. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataSet, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet) method.
Declaration
public Task<int> FillAsync(DataSet dataSet, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | The System.Data.DataSet to fill records with. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataSet. |
FillAsync(DataTable)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable) method.
Declaration
public Task<int> FillAsync(DataTable dataTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The name of the System.Data.DataTable to use for table mapping. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable, IDataReader)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable) method.
Declaration
public Task<int> FillAsync(DataTable dataTable, IDataReader dataReader)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The System.Data.DataTable to fill with records. |
System.Data.IDataReader | dataReader | An instance of System.Data.IDataReader. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable, IDataReader, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable) method.
Declaration
public Task<int> FillAsync(DataTable dataTable, IDataReader dataReader, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The System.Data.DataTable to fill with records. |
System.Data.IDataReader | dataReader | An instance of System.Data.IDataReader. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable, IDbCommand, CommandBehavior)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The System.Data.DataTable to fill with records. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable, IDbCommand, CommandBehavior, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataTable dataTable, IDbCommand command, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The System.Data.DataTable to fill with records. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable) method.
Declaration
public Task<int> FillAsync(DataTable dataTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | The name of the System.Data.DataTable to use for table mapping. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(DataTable[], Int32, Int32, IDbCommand, CommandBehavior)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], System.Int32, System.Int32, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataTable[] dataTables, int startRecord, int maxRecords, IDbCommand command, CommandBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable[] | dataTables | The System.Data.DataTables to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTables. |
FillAsync(DataTable[], Int32, Int32, IDbCommand, CommandBehavior, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], System.Int32, System.Int32, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<int> FillAsync(DataTable[] dataTables, int startRecord, int maxRecords, IDbCommand command, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable[] | dataTables | The System.Data.DataTables to fill with records. |
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.Data.IDbCommand | command | The SQL SELECT statement used to retrieve rows from the data source. |
System.Data.CommandBehavior | behavior | One of the System.Data.CommandBehavior values. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTables. |
FillAsync(Int32, Int32, DataTable[])
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Int32, System.Int32, System.Data.DataTable[]) method.
Declaration
public Task<int> FillAsync(int startRecord, int maxRecords, params DataTable[] dataTables)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.Data.DataTable[] | dataTables | The System.Data.DataTables to fill with records. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillAsync(Int32, Int32, CancellationToken, DataTable[])
Asynchronous version of the System.Data.Common.DbDataAdapter.Fill(System.Int32, System.Int32, System.Data.DataTable[]) method.
Declaration
public Task<int> FillAsync(int startRecord, int maxRecords, CancellationToken cancellationToken, params DataTable[] dataTables)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRecord | The start record. |
System.Int32 | maxRecords | The max number of affected records. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
System.Data.DataTable[] | dataTables | The System.Data.DataTables to fill with records. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully added to or refreshed in the System.Data.DataTable. |
FillSchemaAsync(DataSet, SchemaType)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, IDbCommand, String, CommandBehavior)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.Data.IDbCommand, System.String, System.Data.CommandBehavior) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDbCommand | command | DBCommand to use. |
System.String | srcTable | Source table to use. |
System.Data.CommandBehavior | behavior | Command Behavior |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, IDbCommand, String, CommandBehavior, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.Data.IDbCommand, System.String, System.Data.CommandBehavior) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDbCommand | command | DBCommand to use. |
System.String | srcTable | Source table to use. |
System.Data.CommandBehavior | behavior | Command Behavior |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, String)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.String) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, string srcTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.String | srcTable | Source table to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, String, IDataReader)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.String) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, string srcTable, IDataReader dataReader)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.String | srcTable | Source table to use. |
System.Data.IDataReader | dataReader | DataReader to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, String, IDataReader, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.String) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, string srcTable, IDataReader dataReader, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.String | srcTable | Source table to use. |
System.Data.IDataReader | dataReader | System.Data.IDataReader to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, String, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType, System.String) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, string srcTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.String | srcTable | Source table to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataSet, SchemaType, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataSet, System.Data.SchemaType) method.
Declaration
public Task<DataTable[]> FillSchemaAsync(DataSet dataSet, SchemaType schemaType, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable[]> | System.Data.DataTable[] |
FillSchemaAsync(DataTable, SchemaType)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | DataTable |
FillSchemaAsync(DataTable, SchemaType, IDataReader)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType, IDataReader dataReader)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDataReader | dataReader | DataReader to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | System.Data.DataTable |
FillSchemaAsync(DataTable, SchemaType, IDataReader, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType, IDataReader dataReader, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDataReader | dataReader | DataReader to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | System.Data.DataTable |
FillSchemaAsync(DataTable, SchemaType, IDbCommand, CommandBehavior)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDbCommand | command | DBCommand to use. |
System.Data.CommandBehavior | behavior | Command Behavior |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | System.Data.DataTable |
FillSchemaAsync(DataTable, SchemaType, IDbCommand, CommandBehavior, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType, System.Data.IDbCommand, System.Data.CommandBehavior) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Data.IDbCommand | command | DBCommand to use. |
System.Data.CommandBehavior | behavior | Command behavior. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | System.Data.DataTable |
FillSchemaAsync(DataTable, SchemaType, CancellationToken)
Asynchronous version of the System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable, System.Data.SchemaType) method.
Declaration
public Task<DataTable> FillSchemaAsync(DataTable dataTable, SchemaType schemaType, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Data.SchemaType | schemaType | Schema type to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Data.DataTable> | System.Data.DataTable |
GetBatchedParameter(Int32, Int32)
Returns a System.Data.IDataParameter from one of the commands in the current batch.
Declaration
protected override IDataParameter GetBatchedParameter(int commandIdentifier, int parameterIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | commandIdentifier | The index of the command to retrieve the parameter from. |
System.Int32 | parameterIndex | The index of the parameter within the command. |
Returns
Type | Description |
---|---|
System.Data.IDataParameter | The System.Data.IDataParameter specified. |
Overrides
InitializeBatching()
Initializes batching for the MySqlDataAdapter.
Declaration
protected override void InitializeBatching()
Overrides
OnRowUpdated(RowUpdatedEventArgs)
Overridden. Raises the RowUpdated event.
Declaration
protected override void OnRowUpdated(RowUpdatedEventArgs value)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.RowUpdatedEventArgs | value | A MySqlRowUpdatedEventArgs that contains the event data. |
Overrides
OnRowUpdating(RowUpdatingEventArgs)
Overridden. Raises the RowUpdating event.
Declaration
protected override void OnRowUpdating(RowUpdatingEventArgs value)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.RowUpdatingEventArgs | value | A MySqlRowUpdatingEventArgs that contains the event data. |
Overrides
TerminateBatching()
Ends batching for the MySqlDataAdapter.
Declaration
protected override void TerminateBatching()
Overrides
Update(DataRow[], DataTableMapping)
Declaration
protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow[] | dataRows | |
System.Data.Common.DataTableMapping | tableMapping |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
UpdateAsync(DataRow[])
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataRow[] dataRows)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow[] | dataRows | DataRow[] to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataRow[], DataTableMapping)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataRow[] dataRows, DataTableMapping tableMapping)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow[] | dataRows | DataRow[] to use. |
System.Data.Common.DataTableMapping | tableMapping | Data Table Mapping |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataRow[], DataTableMapping, CancellationToken)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataRow[] dataRows, DataTableMapping tableMapping, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow[] | dataRows | DataRow[] to use. |
System.Data.Common.DataTableMapping | tableMapping | Data Table Mapping |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataRow[], CancellationToken)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataRow[] dataRows, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow[] | dataRows | DataRow[] to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataSet)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataSet dataSet)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataSet, String)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataSet dataSet, string srcTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.String | srcTable | Source table to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataSet, String, CancellationToken)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataSet dataSet, string srcTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.String | srcTable | Source table to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataSet, CancellationToken)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataSet dataSet, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataSet | DataSet to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataTable)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataTable dataTable)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
UpdateAsync(DataTable, CancellationToken)
Asynchronous version of the System.Data.Common.DataAdapter.Update(System.Data.DataSet) method.
Declaration
public Task<int> UpdateAsync(DataTable dataTable, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dataTable | DataTable to use. |
System.Threading.CancellationToken | cancellationToken | System.Threading.CancellationToken to use. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | The number of rows successfully updated from the System.Data.DataSet. |
Events
RowUpdated
Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires.
Declaration
public event MySqlRowUpdatedEventHandler RowUpdated
Event Type
Type | Description |
---|---|
MySqlRowUpdatedEventHandler |
RowUpdating
Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires.
Declaration
public event MySqlRowUpdatingEventHandler RowUpdating
Event Type
Type | Description |
---|---|
MySqlRowUpdatingEventHandler |