MySqlDataAdapterDeleteCommand Property |
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9

public MySqlCommand DeleteCommand { get; set; }
Public Property DeleteCommand As MySqlCommand Get Set
public: property MySqlCommand^ DeleteCommand { MySqlCommand^ get (); void set (MySqlCommand^ value); }
member DeleteCommand : MySqlCommand with get, set
Property Value
Type: MySqlCommandA MySqlCommand used during Update(DataSet) to delete records in the database that correspond to deleted rows in the DataSet.

During Update(DataSet), if this property is not set and primary key information is present in the 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 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.

public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn) { MySqlDataAdapter da = new MySqlDataAdapter(); MySqlCommand cmd; MySqlParameter parm; // Create the SelectCommand. cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn); cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15); cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15); da.SelectCommand = cmd; // Create the DeleteCommand. cmd = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); parm.SourceVersion = DataRowVersion.Original; da.DeleteCommand = cmd; return da; }
Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter Dim da As MySqlDataAdapter = New MySqlDataAdapter() Dim cmd As MySqlCommand Dim parm As MySqlParameter ' Create the SelectCommand. cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn) cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15) cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15) da.SelectCommand = cmd ' Create the DeleteCommand. cmd = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") parm.SourceVersion = DataRowVersion.Original da.DeleteCommand = cmd Return da End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
