MySql.Data Wrapper around NetworkStream. MyNetworkStream is equivalent to NetworkStream, except 1. It throws TimeoutException if read or write timeout occurs, instead of IOException, to match behavior of other streams (named pipe and shared memory). This property comes handy in TimedStream. 2. It implements workarounds for WSAEWOULDBLOCK errors, that can start occuring after stream has times out. For a discussion about the CLR bug, refer to http://tinyurl.com/lhgpyf. This error should never occur, as we're not using asynchronous operations, but apparerntly it does occur directly after timeout has expired. The workaround is hinted in the URL above and implemented like this: For each IO operation, if it throws WSAEWOULDBLOCK, we explicitely set the socket to Blocking and retry the operation once again. Returns the total number of bytes input so far. Returns the total number of bytes output so far. By creating a private ctor, we keep the compiler from creating a default ctor The exception that is thrown when MySQL returns an error. This class cannot be inherited. This class is created whenever the MySql Data Provider encounters an error generated from the server. Any open connections are not automatically closed when an exception is thrown. If the client application determines that the exception is fatal, it should close any open objects or objects. The following example generates a MySqlException due to a missing server, and then displays the exception. Public Sub ShowException() Dim mySelectQuery As String = "SELECT column1 FROM table1" Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;") Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) Try myCommand.Connection.Open() Catch e As MySqlException MessageBox.Show( e.Message ) End Try End Sub public void ShowException() { string mySelectQuery = "SELECT column1 FROM table1"; MySqlConnection myConnection = new MySqlConnection("Data Source=localhost;Database=Sample;"); MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection); try { myCommand.Connection.Open(); } catch (MySqlException e) { MessageBox.Show( e.Message ); } } Gets a number that identifies the type of error. True if this exception was fatal and cause the closing of the connection, false otherwise. Summary description for Version. Read a single quoted identifier from the stream DBProviderFactory implementation for MysqlClient. Gets an instance of the . This can be used to retrieve strongly typed data objects. Returns a strongly typed instance. A new strongly typed instance of DbCommandBuilder. Returns a strongly typed instance. A new strongly typed instance of DbCommand. Returns a strongly typed instance. A new strongly typed instance of DbConnection. Returns a strongly typed instance. A new strongly typed instance of DbDataAdapter. Returns a strongly typed instance. A new strongly typed instance of DbParameter. Returns a strongly typed instance. A new strongly typed instance of DbConnectionStringBuilder. Returns true if a MySqlDataSourceEnumerator can be created; otherwise false. Provide a simple caching layer Provides a means of reading a forward-only stream of rows from a MySQL database. This class cannot be inherited. To create a MySQLDataReader, you must call the method of the object, rather than directly using a constructor. While the MySqlDataReader is in use, the associated is busy serving the MySqlDataReader, and no other operations can be performed on the MySqlConnection other than closing it. This is the case until the method of the MySqlDataReader is called. and are the only properties that you can call after the MySqlDataReader is closed. Though the RecordsAffected property may be accessed at any time while the MySqlDataReader exists, always call Close before returning the value of RecordsAffected to ensure an accurate return value. For optimal performance, MySqlDataReader avoids creating unnecessary objects or making unnecessary copies of data. As a result, multiple calls to methods such as return a reference to the same object. Use caution if you are modifying the underlying value of the objects returned by methods such as GetValue. The following example creates a , a , and a MySqlDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the MySqlDataReader, then the MySqlConnection. Public Sub ReadMyData(myConnString As String) Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders" Dim myConnection As New MySqlConnection(myConnString) Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) myConnection.Open() Dim myReader As MySqlDataReader myReader = myCommand.ExecuteReader() ' Always call Read before accessing data. While myReader.Read() Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1))) End While ' always call Close when done reading. myReader.Close() ' Close the connection when done with it. myConnection.Close() End Sub 'ReadMyData public void ReadMyData(string myConnString) { string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders"; MySqlConnection myConnection = new MySqlConnection(myConnString); MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection); myConnection.Open(); MySqlDataReader myReader; myReader = myCommand.ExecuteReader(); // Always call Read before accessing data. while (myReader.Read()) { Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1)); } // always call Close when done reading. myReader.Close(); // Close the connection when done with it. myConnection.Close(); } Closes the MySqlDataReader object. Gets the value of the specified column as a Boolean. Gets the value of the specified column as a Boolean. Gets the value of the specified column as a byte. Gets the value of the specified column as a byte. Gets the value of the specified column as a sbyte. Gets the value of the specified column as a sbyte. Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset. The zero-based column ordinal. The index within the field from which to begin the read operation. The buffer into which to read the stream of bytes. The index for buffer to begin the read operation. The maximum length to copy into the buffer. The actual number of bytes read. Gets the value of the specified column as a single character. Gets the value of the specified column as a single character. Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset. Gets the name of the source data type. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a DateTime object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a DateTime object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a DateTime object. Call IsDBNull to check for null values before calling this method. MySql allows date columns to contain the value '0000-00-00' and datetime columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain or represent these values. To read a datetime value from a column that might contain zero values, use . The behavior of reading a zero datetime column using this method is defined by the ZeroDateTimeBehavior connection string option. For more information on this option, please refer to . The column name.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a DateTime object. Call IsDBNull to check for null values before calling this method. MySql allows date columns to contain the value '0000-00-00' and datetime columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain or represent these values. To read a datetime value from a column that might contain zero values, use . The behavior of reading a zero datetime column using this method is defined by the ZeroDateTimeBehavior connection string option. For more information on this option, please refer to . The zero-based column ordinal.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a Decimal object. Call IsDBNull to check for null values before calling this method. The column nameThe value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a Decimal object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinalThe value of the specified column. Gets the value of the specified column as a double-precision floating point number. No conversions are performed; therefore, the data retrieved must already be a Double object. Call IsDBNull to check for null values before calling this method. The column nameThe value of the specified column. Gets the value of the specified column as a double-precision floating point number. No conversions are performed; therefore, the data retrieved must already be a Double object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the Type that is the data type of the object. Gets the value of the specified column as a single-precision floating point number. No conversions are performed; therefore, the data retrieved must already be a Float object. Call IsDBNull to check for null values before calling this method. The column nameThe value of the specified column. Gets the value of the specified column as a single-precision floating point number. No conversions are performed; therefore, the data retrieved must already be a Float object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the value of the specified column as a 16-bit signed integer. No conversions are performed; threfore, the data retrieved must already be a 16 bit integer value. Call IsDBNull to check for null values before calling this method. The column nameThe value of the specified column. Gets the value of the specified column as a 16-bit signed integer. No conversions are performed; therefore, the data retrieved must already be a 16 bit integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the value of the specified column as a 32-bit signed integer. No conversions are performed; therefore, the data retrieved must already be a 32 bit integer value. Call IsDBNull to check for null values before calling this method. The column name.The value of the specified column. Gets the value of the specified column as a 32-bit signed integer. No conversions are performed; therefore, the data retrieved must already be a 32 bit integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the value of the specified column as a 64-bit signed integer. No conversions are performed; therefore, the data retrieved must already be a 64 bit integer value. Call IsDBNull to check for null values before calling this method. The column name.The value of the specified column. Gets the value of the specified column as a 64-bit signed integer. No conversions are performed; therefore, the data retrieved must already be a 64 bit integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the name of the specified column. Gets the column ordinal, given the name of the column. Returns a DataTable that describes the column metadata of the MySqlDataReader. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a String object. Call IsDBNull to check for null values before calling this method. The column name.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a String object. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a Time value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a object. No conversions are performed; therefore, the data retrieved must already be a Time value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column in its native format. Gets all attribute columns in the collection for the current row. Gets the value of the specified column as a 16-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 16 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a 16-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 16 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a 32-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 32 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a 32-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 32 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a 64-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 64 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets the value of the specified column as a 64-bit unsigned integer. No conversions are performed; therefore, the data retrieved must already be a 64 bit unsigned integer value. Call IsDBNull to check for null values before calling this method. The zero-based column ordinal or column name.The value of the specified column. Gets a value indicating whether the column contains non-existent or missing values. Advances the data reader to the next result, when reading the results of batch SQL statements. Advances the MySqlDataReader to the next record. Returns an that iterates through the . Gets a value indicating the depth of nesting for the current row. This method is not supported currently and always returns 0. Gets the number of columns in the current row. Gets a value indicating whether the MySqlDataReader contains one or more rows. Gets a value indicating whether the data reader is closed. Gets the number of rows changed, inserted, or deleted by execution of the SQL statement. Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class. Gets the value of a column in its native format. [C#] In C#, this property is the indexer for the MySqlDataReader class. Serializes the given parameter to the given memory stream This method is called by PrepareSqlBuffers to convert the given parameter to bytes and write those bytes to the given memory stream. True if the parameter was successfully serialized, false otherwise. Represents a SQL statement to execute against a MySQL database. This class cannot be inherited. MySqlCommand features the following methods for executing commands at a MySQL database: Item Description ExecuteReader Executes commands that return rows. ExecuteNonQuery Executes commands such as SQL INSERT, DELETE, and UPDATE statements. ExecuteScalar Retrieves a single value (for example, an aggregate value) from a database. You can reset the CommandText property and reuse the MySqlCommand object. However, you must close the MySqlDataReader before you can execute a new or previous command. If a MySqlException is generated by the method executing a MySqlCommand, the MySqlConnection remains open. It is the responsibility of the programmer to close the connection. Using the '@' symbol for paramters is now the preferred approach although the old pattern of using '?' is still supported. Please be aware though that using '@' can cause conflicts when user variables are also used. To help with this situation please see the documentation on the 'allow user variables' connection string option. The 'old syntax' connection string option has now been deprecated. 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 Sub InsertRow(myConnectionString As String) " If the connection string is null, use a default. If myConnectionString = "" Then myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass" End If Dim myConnection As New MySqlConnection(myConnectionString) Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)" Dim myCommand As New MySqlCommand(myInsertQuery) myCommand.Connection = myConnection myConnection.Open() myCommand.ExecuteNonQuery() myCommand.Connection.Close() End Sub public void InsertRow(string myConnectionString) { // If the connection string is null, use a default. if(myConnectionString == "") { myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"; } MySqlConnection myConnection = new MySqlConnection(myConnectionString); string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"; MySqlCommand myCommand = new MySqlCommand(myInsertQuery); myCommand.Connection = myConnection; myConnection.Open(); myCommand.ExecuteNonQuery(); myCommand.Connection.Close(); } Initializes a new instance of the MySqlCommand class. The following example creates a MySqlCommand and sets some of its properties. This example shows how to use one of the overloaded versions of the MySqlCommand constructor. For other examples that might be available, see the individual overload topics. Public Sub CreateMySqlCommand() Dim myConnection As New MySqlConnection _ ("Persist Security Info=False;database=test;server=myServer") myConnection.Open() Dim myTrans As MySqlTransaction = myConnection.BeginTransaction() Dim mySelectQuery As String = "SELECT * FROM MyTable" Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans) myCommand.CommandTimeout = 20 End Sub public void CreateMySqlCommand() { MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False; database=test;server=myServer"); myConnection.Open(); MySqlTransaction myTrans = myConnection.BeginTransaction(); string mySelectQuery = "SELECT * FROM myTable"; MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans); myCommand.CommandTimeout = 20; } public: void CreateMySqlCommand() { MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False; database=test;server=myServer"); myConnection->Open(); MySqlTransaction* myTrans = myConnection->BeginTransaction(); String* mySelectQuery = S"SELECT * FROM myTable"; MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans); myCommand->CommandTimeout = 20; }; Initializes a new instance of the MySqlCommand class. The base constructor initializes all fields to their default values. The following table shows initial property values for an instance of . Properties Initial Value empty string ("") 0 CommandType.Text Null You can change the value for any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim myCommand As New MySqlCommand() myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { MySqlCommand myCommand = new MySqlCommand(); myCommand.CommandType = CommandType.Text; } Initializes a new instance of the class with the text of the query. The text of the query. When an instance of is created, the following read/write properties are set to initial values. Properties Initial Value cmdText 0 CommandType.Text Null You can change the value for any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim sql as String = "SELECT * FROM mytable" Dim myCommand As New MySqlCommand(sql) myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { string sql = "SELECT * FROM mytable"; MySqlCommand myCommand = new MySqlCommand(sql); myCommand.CommandType = CommandType.Text; } Initializes a new instance of the class with the text of the query and a . The text of the query. A that represents the connection to an instance of SQL Server. When an instance of is created, the following read/write properties are set to initial values. Properties Initial Value cmdText 0 CommandType.Text connection You can change the value for any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim conn as new MySqlConnection("server=myServer") Dim sql as String = "SELECT * FROM mytable" Dim myCommand As New MySqlCommand(sql, conn) myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { MySqlConnection conn = new MySqlConnection("server=myserver") string sql = "SELECT * FROM mytable"; MySqlCommand myCommand = new MySqlCommand(sql, conn); myCommand.CommandType = CommandType.Text; } Initializes a new instance of the class with the text of the query, a , and the . The text of the query. A that represents the connection to an instance of SQL Server. The in which the executes. When an instance of is created, the following read/write properties are set to initial values. Properties Initial Value cmdText 0 CommandType.Text connection You can change the value for any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim conn as new MySqlConnection("server=myServer") conn.Open(); Dim txn as MySqlTransaction = conn.BeginTransaction() Dim sql as String = "SELECT * FROM mytable" Dim myCommand As New MySqlCommand(sql, conn, txn) myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { MySqlConnection conn = new MySqlConnection("server=myserver") conn.Open(); MySqlTransaction txn = conn.BeginTransaction(); string sql = "SELECT * FROM mytable"; MySqlCommand myCommand = new MySqlCommand(sql, conn, txn); myCommand.CommandType = CommandType.Text; } Attempts to cancel the execution of a currently active command Cancelling a currently active query only works with MySQL versions 5.0.0 and higher. Creates a new instance of a object. This method is a strongly-typed version of . A object. Check the connection to make sure - it is open - it is not currently being used by a reader - and we have the right version of MySQL for the requested command type Executes a SQL statement against the connection and returns the number of rows affected. Number of rows affected You can use ExecuteNonQuery to perform any type of database operation, however any resultsets returned will not be available. Any output parameters used in calling a stored procedure will be populated with data and can be retrieved after execution is complete. For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1. The following example creates a MySqlCommand and then executes it using ExecuteNonQuery. The example is passed a string that is a SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to connect to the data source. Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection) Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection) myCommand.Connection.Open() myCommand.ExecuteNonQuery() myConnection.Close() End Sub public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection) { MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection); myCommand.Connection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); } Reset SQL_SELECT_LIMIT that could have been modified by CommandBehavior. Sends the to the Connection and builds a . A object. When the property is set to StoredProcedure, the property should be set to the name of the stored procedure. The command executes this stored procedure when you call ExecuteReader. While the is in use, the associated is busy serving the MySqlDataReader. While in this state, no other operations can be performed on the MySqlConnection other than closing it. This is the case until the method of the MySqlDataReader is called. The following example creates a , then executes it by passing a string that is a SQL SELECT statement, and a string to use to connect to the data source. Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection) Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) myConnection.Open() Dim myReader As MySqlDataReader myReader = myCommand.ExecuteReader() Try While myReader.Read() Console.WriteLine(myReader.GetString(0)) End While Finally myReader.Close myConnection.Close End Try End Sub public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection) { MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection); myConnection.Open(); MMySqlDataReader myReader; myReader = myCommand.ExecuteReader(); try { while(myReader.Read()) { Console.WriteLine(myReader.GetString(0)); } } finally { myReader.Close(); myConnection.Close(); } } Sends the to the Connection, and builds a using one of the values. One of the values. When the property is set to StoredProcedure, the property should be set to the name of the stored procedure. The command executes this stored procedure when you call ExecuteReader. The supports a special mode that enables large binary values to be read efficiently. For more information, see the SequentialAccess setting for . While the is in use, the associated is busy serving the MySqlDataReader. While in this state, no other operations can be performed on the MySqlConnection other than closing it. This is the case until the method of the MySqlDataReader is called. If the MySqlDataReader is created with CommandBehavior set to CloseConnection, closing the MySqlDataReader closes the connection automatically. When calling ExecuteReader with the SingleRow behavior, you should be aware that using a limit clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The method will still return false after the first row but pulling all rows of data into the client will have a performance impact. If the limit clause is not necessary, it should be avoided. A object. Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored. The first column of the first row in the result set, or a null reference if the result set is empty Use the ExecuteScalar method to retrieve a single value (for example, an aggregate value) from a database. This requires less code than using the method, and then performing the operations necessary to generate the single value using the data returned by a The following example creates a and then executes it using ExecuteScalar. The example is passed a string that is a SQL statement that returns an aggregate result, and a string to use to connect to the data source. Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection) Dim myCommand As New MySqlCommand(myScalarQuery, myConnection) myCommand.Connection.Open() myCommand.ExecuteScalar() myConnection.Close() End Sub public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection) { MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection); myCommand.Connection.Open(); myCommand.ExecuteScalar(); myConnection.Close(); } public: void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection) { MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection); myCommand->Connection->Open(); myCommand->ExecuteScalar(); myConnection->Close(); } Creates a prepared version of the command on an instance of MySQL Server. Prepared statements are only supported on MySQL version 4.1 and higher. Calling prepare while connected to earlier versions of MySQL will succeed but will execute the statement in the same way as unprepared. The following example demonstrates the use of the Prepare method. public sub PrepareExample() Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection) cmd.Parameters.Add( "@val", 10 ) cmd.Prepare() cmd.ExecuteNonQuery() cmd.Parameters(0).Value = 20 cmd.ExecuteNonQuery() end sub private void PrepareExample() { MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection); cmd.Parameters.Add( "@val", 10 ); cmd.Prepare(); cmd.ExecuteNonQuery(); cmd.Parameters[0].Value = 20; cmd.ExecuteNonQuery(); } Initiates the asynchronous execution of the SQL statement or stored procedure that is described by this , and retrieves one or more result sets from the server. An that can be used to poll, wait for results, or both; this value is also needed when invoking EndExecuteReader, which returns a instance that can be used to retrieve the returned rows. Initiates the asynchronous execution of the SQL statement or stored procedure that is described by this using one of the CommandBehavior values. One of the values, indicating options for statement execution and data retrieval. An that can be used to poll, wait for results, or both; this value is also needed when invoking EndExecuteReader, which returns a instance that can be used to retrieve the returned rows. Finishes asynchronous execution of a SQL statement, returning the requested . The returned by the call to . A MySqlDataReader object that can be used to retrieve the requested rows. Initiates the asynchronous execution of the SQL statement or stored procedure that is described by this . An delegate that is invoked when the command's execution has completed. Pass a null reference (Nothing in Visual Basic) to indicate that no callback is required. A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the property. An that can be used to poll or wait for results, or both; this value is also needed when invoking , which returns the number of affected rows. Initiates the asynchronous execution of the SQL statement or stored procedure that is described by this . An that can be used to poll or wait for results, or both; this value is also needed when invoking , which returns the number of affected rows. Finishes asynchronous execution of a SQL statement. The returned by the call to . Creates a clone of this MySqlCommand object. CommandText, Connection, and Transaction properties are included as well as the entire parameter list. The cloned MySqlCommand object Gets or sets the SQL statement to execute at the data source. The SQL statement or stored procedure to execute. The default is an empty string. When the property is set to StoredProcedure, the CommandText property should be set to the name of the stored procedure. The user may be required to use escape character syntax if the stored procedure name contains any special characters. The command executes this stored procedure when you call one of the Execute methods. Starting with Connector/Net 5.0, having both a stored function and stored procedure with the same name in the same database is not supported. It is suggested that you provide unqiue names for your stored routines. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim myCommand As New MySqlCommand() myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id" myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { MySqlCommand myCommand = new MySqlCommand(); myCommand.CommandText = "SELECT * FROM mytable ORDER BY id"; myCommand.CommandType = CommandType.Text; } Gets or sets the wait time before terminating the attempt to execute a command and generating an error. The time (in seconds) to wait for the command to execute. The default is 30 seconds. CommandTimeout is dependent on the ability of MySQL to cancel an executing query. Because of this, CommandTimeout is only supported when connected to MySQL version 5.0.0 or higher. Gets or sets a value indicating how the property is to be interpreted. One of the values. The default is Text. When you set the CommandType property to StoredProcedure, you should set the property to the name of the stored procedure. The command executes this stored procedure when you call one of the Execute methods. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim myCommand As New MySqlCommand() myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { MySqlCommand myCommand = new MySqlCommand(); myCommand.CommandType = CommandType.Text; } Gets or sets the used by this instance of the . The connection to a data source. The default value is a null reference (Nothing in Visual Basic). If you set Connection while a transaction is in progress and the property is not null, an is generated. If the Transaction property is not null and the transaction has already been committed or rolled back, Transaction is set to null. The following example creates a and sets some of its properties. Public Sub CreateMySqlCommand() Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id" Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer" Dim myCommand As New MySqlCommand(mySelectQuery) myCommand.Connection = New MySqlConnection(myConnectString) myCommand.CommandType = CommandType.Text End Sub public void CreateMySqlCommand() { string mySelectQuery = "SELECT * FROM mytable ORDER BY id"; string myConnectString = "Persist Security Info=False;database=test;server=myServer"; MySqlCommand myCommand = new MySqlCommand(mySelectQuery); myCommand.Connection = new MySqlConnection(myConnectString); myCommand.CommandType = CommandType.Text; } Get the The parameters of the SQL statement or stored procedure. The default is an empty collection. Connector/Net does not support unnamed parameters. Every parameter added to the collection must have an associated name. The following example creates a and displays its parameters. To accomplish this, the method is passed a , a query string that is a SQL SELECT statement, and an array of objects. Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _ mySelectQuery As String, myParamArray() As MySqlParameter) Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age" myCommand.UpdatedRowSource = UpdateRowSource.Both myCommand.Parameters.Add(myParamArray) Dim j As Integer For j = 0 To myCommand.Parameters.Count - 1 myCommand.Parameters.Add(myParamArray(j)) Next j Dim myMessage As String = "" Dim i As Integer For i = 0 To myCommand.Parameters.Count - 1 myMessage += myCommand.Parameters(i).ToString() & ControlChars.Cr Next i Console.WriteLine(myMessage) End Sub public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery, MySqlParameter[] myParamArray) { MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection); myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age"; myCommand.Parameters.Add(myParamArray); for (int j=0; j<myParamArray.Length; j++) { myCommand.Parameters.Add(myParamArray[j]) ; } string myMessage = ""; for (int i = 0; i < myCommand.Parameters.Count; i++) { myMessage += myCommand.Parameters[i].ToString() + "\n"; } MessageBox.Show(myMessage); } Gets or sets the within which the executes. The . The default value is a null reference (Nothing in Visual Basic). You cannot set the Transaction property if it is already set to a specific value, and the command is in the process of executing. If you set the transaction property to a object that is not connected to the same as the object, an exception will be thrown the next time you attempt to execute a statement. Gets or sets a value indicating whether the command object should be visible in a Windows Form Designer control. Gets or sets how command results are applied to the DataRow when used by the Update method of the DbDataAdapter. Mark - or + signs that are unary ops as no output Summary description for BaseDriver. Loads all the current character set names and ids for this server into the charSets hashtable For pooled connections, time when the driver was put into idle queue Returns true if this connection can handle batch SQL natively This means MySQL 4.1.1 or later. return the ordinal for the given column name Closes the current resultset, dumping any data still on the wire Loads the column metadata for the current resultset Retrieve the value as the given column index The column value to retrieve The value as the given column Summary description for MySqlPoolManager. Remove drivers that have been idle for too long. We are adding a custom installer class to our assembly so our installer can make proper changes to the machine.config file. We override Install so we can add our assembly to the proper machine.config files. We override Uninstall so we can remove out assembly from the machine.config files. A strongly-typed resource class, for looking up localized strings, etc. Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. Looks up a localized string similar to Improper MySqlCommandBuilder state: adapter is null. Looks up a localized string similar to Improper MySqlCommandBuilder state: adapter's SelectCommand is null. Looks up a localized string similar to Invalid attempt to access a field before calling Read(). Looks up a localized string similar to Version string not in acceptable format. Looks up a localized string similar to The buffer cannot be null. Looks up a localized string similar to Buffer is not large enough. Looks up a localized string similar to Canceling an executing query requires MySQL 5.0 or higher.. Looks up a localized string similar to Canceling an active query is only supported on MySQL 5.0.0 and above. . Looks up a localized string similar to MySqlCommandBuilder does not support multi-table statements. Looks up a localized string similar to MySqlCommandBuilder cannot operate on tables with no unique or key columns. Looks up a localized string similar to Chaos isolation level is not supported. Looks up a localized string similar to The CommandText property has not been properly initialized.. Looks up a localized string similar to The connection is already open.. Looks up a localized string similar to Connection unexpectedly terminated.. Looks up a localized string similar to Connection must be valid and open. Looks up a localized string similar to The connection is not open.. Looks up a localized string similar to The connection property has not been set or is null.. Looks up a localized string similar to Could not find specified column in results: {0}. Looks up a localized string similar to Count cannot be negative. Looks up a localized string similar to SetLength is not a valid operation on CompressedStream. Looks up a localized string similar to The given value was not in a supported format.. Looks up a localized string similar to There is already an open DataReader associated with this Connection which must be closed first.. Looks up a localized string similar to The default connection encoding was not found. Please report this as a bug along with your connection string and system details.. Looks up a localized string similar to MySQL Connector/Net does not currently support distributed transactions.. Looks up a localized string similar to Error creating socket connection. Looks up a localized string similar to Fatal error encountered during command execution.. Looks up a localized string similar to Fatal error encountered during data read.. Looks up a localized string similar to Fatal error encountered attempting to read the resultset.. Looks up a localized string similar to From index and length use more bytes than from contains. Looks up a localized string similar to From index must be a valid index inside the from buffer. Looks up a localized string similar to Call to GetHostEntry failed after {0} while querying for hostname '{1}': SocketErrorCode={2}, ErrorCode={3}, NativeErrorCode={4}.. Looks up a localized string similar to Retrieving procedure metadata for {0} from server.. Looks up a localized string similar to Value has an unsupported format.. Looks up a localized string similar to An incorrect response was received from the server.. Looks up a localized string similar to Index and length use more bytes than to has room for. Looks up a localized string similar to Index must be a valid position in the buffer. Looks up a localized string similar to You have specified an invalid column ordinal.. Looks up a localized string similar to The requested value '{0}' is invalid for the given keyword '{1}'.. Looks up a localized string similar to Procedure or function '{0}' cannot be found in database '{1}'.. Looks up a localized string similar to '{0}' is an illegal value for a boolean option.. Looks up a localized string similar to Keyword does not allow null values.. Looks up a localized string similar to Keyword not supported.. Looks up a localized string similar to ACCESSIBLE ADD ALL ALTER ANALYZE AND AS ASC ASENSITIVE BEFORE BETWEEN BIGINT BINARY BLOB BOTH BY CALL CASCADE CASE CHANGE CHAR CHARACTER CHECK COLLATE COLUMN CONDITION CONNECTION CONSTRAINT CONTINUE CONVERT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATABASE DATABASES DAY_HOUR DAY_MICROSECOND DAY_MINUTE DAY_SECOND DEC DECIMAL DECLARE DEFAULT DELAYED DELETE DESC DESCRIBE DETERMINISTIC DISTINCT DISTINCTROW DIV DOUBLE DROP DUAL EACH ELSE ELSEIF ENCLOSED ESCAPED EXISTS EXIT EXP [rest of string was truncated]";. Looks up a localized string similar to INTERNAL ERROR: More than one output parameter row detected.. Looks up a localized string similar to Multiple simultaneous connections or connections with different connection strings inside the same transaction are not currently supported.. Looks up a localized string similar to NamedPipeStream does not support seeking. Looks up a localized string similar to NamedPipeStream doesn't support SetLength. Looks up a localized string similar to Invalid attempt to call NextResult when the reader is closed.. Looks up a localized string similar to When calling stored procedures and 'Use Procedure Bodies' is false, all parameters must have their type explicitly set.. Looks up a localized string similar to Nested transactions are not supported.. Looks up a localized string similar to The host {0} does not support SSL connections.. Looks up a localized string similar to The object is not open or has been disposed.. Looks up a localized string similar to Offset cannot be negative. Looks up a localized string similar to Offset must be a valid position in buffer. Looks up a localized string similar to Parameter '{0}' has already been defined.. Looks up a localized string similar to Parameter cannot have a negative value. Looks up a localized string similar to Parameter cannot be null. Looks up a localized string similar to Parameter is invalid.. Looks up a localized string similar to Parameter '{0}' must be defined.. Looks up a localized string similar to Parameter '{0}' was not found during prepare.. Looks up a localized string similar to Password must be valid and contain length characters. Looks up a localized string similar to This category includes a series of counters for MySQL.. Looks up a localized string similar to .NET Data Provider for MySQL. Looks up a localized string similar to The number of times a procedures metadata had to be queried from the server.. Looks up a localized string similar to Hard Procedure Queries. Looks up a localized string similar to The number of times a procedures metadata was retrieved from the client-side cache.. Looks up a localized string similar to Soft Procedure Queries. Looks up a localized string similar to same name are not supported.. Looks up a localized string similar to Packets larger than max_allowed_packet are not allowed.. Looks up a localized string similar to Reading from the stream has failed.. Looks up a localized string similar to Invalid attempt to read a prior column using SequentialAccess. Looks up a localized string similar to Routine '{0}' cannot be found. Either check the spelling or make sure you have sufficient rights to execute the routine.. Looks up a localized string similar to Connector/Net no longer supports server versions prior to 4.1. Looks up a localized string similar to Socket streams do not support seeking. Looks up a localized string similar to Retrieving procedure metadata for {0} from procedure cache.. Looks up a localized string similar to Stored procedures are not supported on this version of MySQL. Looks up a localized string similar to The stream has already been closed. Looks up a localized string similar to The stream does not support reading. Looks up a localized string similar to The stream does not support writing. Looks up a localized string similar to Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. Looks up a localized string similar to error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.. Looks up a localized string similar to {0}: Connection Closed. Looks up a localized string similar to Unable to trace. There are more than Int32.MaxValue connections in use.. Looks up a localized string similar to {0}: Error encountered during row fetch. Number = {1}, Message={2}. Looks up a localized string similar to {0}: Connection Opened: connection string = '{1}'. Looks up a localized string similar to {0}: Error encountered attempting to open result: Number={1}, Message={2}. Looks up a localized string similar to {0}: Query Closed. Looks up a localized string similar to {0}: Query Normalized: {2}. Looks up a localized string similar to {0}: Query Opened: {2}. Looks up a localized string similar to {0}: Resultset Opened: field(s) = {1}, affected rows = {2}, inserted id = {3}. Looks up a localized string similar to {0}: Resultset Closed. Total rows={1}, skipped rows={2}, size (bytes)={3}. Looks up a localized string similar to {0}: Set Database: {1}. Looks up a localized string similar to {0}: Statement closed: statement id = {1}. Looks up a localized string similar to {0}: Statement executed: statement id = {1}. Looks up a localized string similar to {0}: Statement prepared: sql='{1}', statement id={2}. Looks up a localized string similar to {0}: Usage Advisor Warning: Query is using a bad index. Looks up a localized string similar to {0}: Usage Advisor Warning: The field '{2}' was converted to the following types: {3}. Looks up a localized string similar to {0}: Usage Advisor Warning: Query does not use an index. Looks up a localized string similar to {0}: Usage Advisor Warning: The following columns were not accessed: {2}. Looks up a localized string similar to {0}: Usage Advisor Warning: Skipped {2} rows. Consider a more focused query.. Looks up a localized string similar to {0}: MySql Warning: Level={1}, Code={2}, Message={3}. Looks up a localized string similar to Unable to connect to any of the specified MySQL hosts.. Looks up a localized string similar to Unable to derive stored routine parameters. The 'Parameters' information schema table is not available and access to the stored procedure body has been disabled.. Looks up a localized string similar to An error occured attempting to enumerate the user-defined functions. Do you have SELECT privileges on the mysql.func table?. Looks up a localized string similar to Unable to execute stored procedure '{0}'.. Looks up a localized string similar to There was an error parsing the foreign key definition.. Looks up a localized string similar to Unable to retrieve stored routine parameters. Either grant access to the routine or add the 'Use Procedure Bodies=false' option to your connection string.. Looks up a localized string similar to Unable to retrieve stored procedure metadata for routine '{0}'. Either grant SELECT privilege to mysql.proc for this user or use "use procedure bodies=false" with your connection string.. Looks up a localized string similar to Unable to start a second async operation while one is running.. Looks up a localized string similar to Unix sockets are not supported on Windows. Looks up a localized string similar to The requested column value could not be treated as or conveted to a Guid.. Looks up a localized string similar to Writing to the stream failed.. Looks up a localized string similar to Parameter '{0}' is not found but a parameter with the name '{1}' is found. Parameter names must include the leading parameter marker.. Summary description for MySqlPool. It is assumed that this method is only called from inside an active lock. It is assumed that this method is only called from inside an active lock. Removes a connection from the in use pool. The only situations where this method would be called are when a connection that is in use gets some type of fatal exception or when the connection is being returned to the pool and it's too old to be returned. Clears this pool of all idle connections and marks this pool and being cleared so all other connections are closed when they are returned. Remove expired drivers from the idle pool Closing driver is a potentially lengthy operation involving network IO. Therefore we do not close expired drivers while holding idlePool.SyncRoot lock. We just remove the old drivers from the idle queue and return them to the caller. The caller will need to close them (or let GC close them) It is assumed that this property will only be used from inside an active lock. Indicates whether this pool is being cleared. WriteInteger Execute the load operation The number of rows inserted. Gets or sets the connection. The connection. Gets or sets the field terminator. The field terminator. Gets or sets the line terminator. The line terminator. Gets or sets the name of the table. The name of the table. Gets or sets the character set. The character set. Gets or sets the name of the file. The name of the file. Gets or sets the timeout. The timeout. Gets or sets a value indicating whether the filename that is to be loaded is local to the client or not true if local; otherwise, false. Gets or sets the number of lines to skip. The number of lines to skip. Gets or sets the line prefix. The line prefix. Gets or sets the field quotation character. The field quotation character. Gets or sets a value indicating whether [field quotation optional]. true if [field quotation optional]; otherwise, false. Gets or sets the escape character. The escape character. Gets or sets the conflict option. The conflict option. Gets or sets the priority. The priority. Gets the columns. The columns. Gets the expressions. The expressions. This is the default and indicates normal priority Low priority will cause the load operation to wait until all readers of the table have finished. This only affects storage engines that use only table-level locking such as MyISAM, Memory, and Merge. Concurrent priority is only relevant for MyISAM tables and signals that if the table has no free blocks in the middle that other readers can retrieve data from the table while the load operation is happening. This is the default and indicates normal operation. In the event of a LOCAL load, this is the same as ignore. When the data file is on the server, then a key conflict will cause an error to be thrown and the rest of the data file ignored. Replace column values when a key conflict occurs. Ignore any rows where the primary key conflicts. This method returns the literal value received The literal to return The received value This method returns the literal value received The literal to return The received value This method returns the literal value received The literal to return The received value This method returns the literal value received The literal to return The received value Performs an unsigned bitwise right shift with the specified number Number to operate on Ammount of bits to shift The resulting number from the shift operation Performs an unsigned bitwise right shift with the specified number Number to operate on Ammount of bits to shift The resulting number from the shift operation Performs an unsigned bitwise right shift with the specified number Number to operate on Ammount of bits to shift The resulting number from the shift operation Performs an unsigned bitwise right shift with the specified number Number to operate on Ammount of bits to shift The resulting number from the shift operation Reads a number of characters from the current source Stream and writes the data to the target array at the specified index. The source Stream to read from. Contains the array of characteres read from the source Stream. The starting index of the target array. The maximum number of characters to read from the source Stream. The number of characters read. The number will be less than or equal to count depending on the data available in the source Stream. Returns -1 if the end of the stream is reached. Reads a number of characters from the current source TextReader and writes the data to the target array at the specified index. The source TextReader to read from Contains the array of characteres read from the source TextReader. The starting index of the target array. The maximum number of characters to read from the source TextReader. The number of characters read. The number will be less than or equal to count depending on the data available in the source TextReader. Returns -1 if the end of the stream is reached. Converts a string to an array of bytes The string to be converted The new array of bytes Converts an array of bytes to an array of chars The array of bytes to convert The new array of chars Writes an object to the specified Stream The target Stream The object to be sent Writes an object to the specified BinaryWriter The target BinaryWriter The object to be sent Deserializes an object, or an entire graph of connected objects, and returns the object intance Reader instance used to read the object The object instance Writes the exception stack trace to the received stream Exception to obtain information from Output sream used to write to Summary description for StoredProcedure. Summary description for PreparedStatement. Prepares CommandText for use with the Prepare method Command text stripped of all paramter names Takes the output of TokenizeSql and creates a single string of SQL that only contains '?' markers for each parameter. It also creates the parameterMap array list that includes all the paramter names in the order they appeared in the SQL Summary description for ClientParam. DB Operations Code Specifies MySQL specific data type of a field, property, for use in a . A fixed precision and scale numeric value between -1038 -1 and 10 38 -1. The signed range is -128 to 127. The unsigned range is 0 to 255. A 16-bit signed integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535 Specifies a 24 (3 byte) signed or unsigned value. A 32-bit signed integer A 64-bit signed integer. A small (single-precision) floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. A normal-size (double-precision) floating-point number. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308. A timestamp. The range is '1970-01-01 00:00:00' to sometime in the year 2037 Date The supported range is '1000-01-01' to '9999-12-31'. Time The range is '-838:59:59' to '838:59:59'. DateTime The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. Datetime The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the 2-digit format (70-69). Obsolete Use Datetime or Date type A variable-length string containing 0 to 65535 characters Bit-field data type New Decimal An enumeration. A string object that can have only one value, chosen from the list of values 'value1', 'value2', ..., NULL or the special "" error value. An ENUM can have a maximum of 65535 distinct values A set. A string object that can have zero or more values, each of which must be chosen from the list of values 'value1', 'value2', ... A SET can have a maximum of 64 members. A binary column with a maximum length of 255 (2^8 - 1) characters A binary column with a maximum length of 16777215 (2^24 - 1) bytes. A binary column with a maximum length of 4294967295 or 4G (2^32 - 1) bytes. A binary column with a maximum length of 65535 (2^16 - 1) bytes. A variable-length string containing 0 to 255 bytes. A fixed-length string. Geometric (GIS) data type. Unsigned 8-bit value. Unsigned 16-bit value. Unsigned 24-bit value. Unsigned 32-bit value. Unsigned 64-bit value. Fixed length binary string. Variable length binary string. A text column with a maximum length of 255 (2^8 - 1) characters. A text column with a maximum length of 16777215 (2^24 - 1) characters. A text column with a maximum length of 4294967295 or 4G (2^32 - 1) characters. A text column with a maximum length of 65535 (2^16 - 1) characters. A guid column Allows the user to specify the type of connection that should be used. TCP/IP style connection. Works everywhere. Named pipe connection. Works only on Windows systems. Unix domain socket connection. Works only with Unix systems. Shared memory connection. Currently works only with Windows systems. SSL options for connection. Do not use SSL. Use SSL, if server supports it. Always use SSL. Deny connection if server does not support SSL. Do not perform server certificate validation. Always use SSL. Validate server SSL certificate, but different host name mismatch. Always use SSL and perform full certificate validation. Specifies the connection types supported Use TCP/IP sockets. Use client library. Use MySQL embedded server. Do not use certificate store Use certificate store for the current user User certificate store for the machine Summary description for Field. Summary description for MySqlConversionException. Ctor Represents a collection of parameters relevant to a as well as their respective mappings to columns in a . This class cannot be inherited. The number of the parameters in the collection must be equal to the number of parameter placeholders within the command text, or an exception will be generated. The following example creates multiple instances of through the MySqlParameterCollection collection within the . These parameters are used to select data within the data source and place the data in the . This code assumes that a DataSet and a MySqlDataAdapter have already been created with the appropriate schema, commands, and connection. Public Sub AddParameters() ' ... ' create myDataSet and myDataAdapter ' ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters" myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239 myDataAdapter.Fill(myDataSet) End Sub 'AddSqlParameters public void AddSqlParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"; myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239; myDataAdapter.Fill(myDataSet); } Adds the specified object to the . The to add to the collection. The newly added object. Adds a to the given the specified parameter name and value. The name of the parameter. The of the to add to the collection. The newly added object. Adds a to the given the parameter name and the data type. The name of the parameter. One of the values. The newly added object. Adds a to the with the parameter name, the data type, and the column length. The name of the parameter. One of the values. The length of the column. The newly added object. Adds a to the with the parameter name, the data type, the column length, and the source column name. The name of the parameter. One of the values. The length of the column. The name of the source column. The newly added object. Adds an array of values to the end of the . Retrieve the parameter with the given name. Adds the specified object to the . The to add to the collection. The index of the new object. Removes all items from the collection. Gets a value indicating whether a with the specified parameter name exists in the collection. The name of the object to find. true if the collection contains the parameter; otherwise, false. Gets a value indicating whether a MySqlParameter exists in the collection. The value of the object to find. true if the collection contains the object; otherwise, false. Gets a value indicating whether a exists in the collection. Copies MySqlParameter objects from the MySqlParameterCollection to the specified array. Returns an enumerator that iterates through the . Gets the location of the in the collection with a specific parameter name. The name of the object to retrieve. The zero-based location of the in the collection. Gets the location of a in the collection. The object to locate. The zero-based location of the in the collection. Gets the location of a in the collection. Inserts a MySqlParameter into the collection at the specified index. Removes the specified MySqlParameter from the collection. Removes the specified from the collection using the parameter name. The name of the object to retrieve. Removes the specified from the collection using a specific index. The zero-based index of the parameter. Removes the specified from the collection. This method will update all the items in the index hashes when we insert a parameter somewhere in the middle Gets the at the specified index. Gets the with a specified attribute. [C#] In C#, this property is the indexer for the class. Gets the with the specified name. Gets the number of MySqlParameter objects in the collection. Gets a value that indicates whether the has a fixed size. Gets a value that indicates whether the is read-only. Gets a value that indicates whether the is synchronized. Gets an object that can be used to synchronize access to the . Stream that supports timeout of IO operations. This class is used is used to support timeouts for SQL command, where a typical operation involves several network reads/writes. Timeout here is defined as the accumulated duration of all IO operations. Construct a TimedStream Undelying stream Figure out whether it is necessary to reset timeout on stream. We track the current value of timeout and try to avoid changing it too often, because setting Read/WriteTimeout property on network stream maybe a slow operation that involves a system call (setsockopt). Therefore, we allow a small difference, and do not reset timeout if current value is slightly greater than the requested one (within 0.1 second). Common handler for IO exceptions. Resets timeout to infinity if timeout exception is detected and stops the times. original exception Returns the total number of bytes input so far. Returns the total number of bytes output so far. GetForeignKeysOnTable retrieves the foreign keys on the given table. Since MySQL supports foreign keys on versions prior to 5.0, we can't use information schema. MySQL also does not include any type of SHOW command for foreign keys so we have to resort to use SHOW CREATE TABLE and parsing the output. The table to store the key info in. The table to get the foeign key info for. Only get foreign keys that match this name. Should column information be included in the table. Represents a parameter to a , and optionally, its mapping to columns. This class cannot be inherited. Initializes a new instance of the MySqlParameter class. Initializes a new instance of the class with the parameter name and a value of the new MySqlParameter. The name of the parameter to map. An that is the value of the . Initializes a new instance of the class with the parameter name and the data type. The name of the parameter to map. One of the values. Initializes a new instance of the class with the parameter name, the , and the size. The name of the parameter to map. One of the values. The length of the parameter. Initializes a new instance of the class with the parameter name, the , the size, and the source column name. The name of the parameter to map. One of the values. The length of the parameter. The name of the source column. Initializes a new instance of the class with the parameter name, the type of the parameter, the size of the parameter, a , the precision of the parameter, the scale of the parameter, the source column, a to use, and the value of the parameter. The name of the parameter to map. One of the values. The length of the parameter. One of the values. true if the value of the field can be null, otherwise false. The total number of digits to the left and right of the decimal point to which is resolved. The total number of decimal places to which is resolved. The name of the source column. One of the values. An that is the value of the . Overridden. Gets a string containing the . Resets the DbType property to its original settings. Gets or sets the of the parameter. Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter. As of MySql version 4.1 and earlier, input-only is the only valid choice. Gets or sets a value indicating whether the parameter accepts null values. Gets or sets the MySqlDbType of the parameter. Gets or sets the name of the MySqlParameter. Gets or sets the maximum number of digits used to represent the property. Gets or sets the number of decimal places to which is resolved. Gets or sets the maximum size, in bytes, of the data within the column. Gets or sets the name of the source column that is mapped to the and used for loading or returning the . Gets or sets the to use when loading . Gets or sets the value of the parameter. Returns the possible values for this parameter if this parameter is of type SET or ENUM. Returns null otherwise. Sets or gets a value which indicates whether the source column is nullable. This allows to correctly generate Update statements for nullable columns. Collection of error codes that can be returned by the server Error level Error code Error message Provides a reference to error codes returned by MySQL. There is already a key with the given values. The specified key was not found. Given when the connection is unable to successfully connect to host. Normally returned when an incorrect password is given Duplicate Key Name Duplicate Key Entry The given host is not allowed to connect The anonymous user is not allowed to connect The given password is not allowed The given password does not match An attempt was made to send or receive a packet larger than max_allowed_packet_size Summary description for CompressedStream. Helper class to encapsulate shared memory functionality Also cares of proper cleanup of file mapping object and cew Summary description for SharedMemoryStream. Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited. The does not automatically generate the SQL statements required to reconcile changes made to a DataSet with the associated instance of MySQL. However, you can create a MySqlCommandBuilder object to automatically generate SQL statements for single-table updates if you set the SelectCommand property of the MySqlDataAdapter. Then, any additional SQL statements that you do not set are generated by the MySqlCommandBuilder. The MySqlCommandBuilder registers itself as a listener for RowUpdating events whenever you set the property. You can only associate one MySqlDataAdapter or MySqlCommandBuilder object with each other at one time. To generate INSERT, UPDATE, or DELETE statements, the MySqlCommandBuilder uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata has is retrieved (for example, after the first update), you should call the method to update the metadata. The SelectCommand must also return at least one primary key or unique column. If none are present, an InvalidOperation exception is generated, and the commands are not generated. The MySqlCommandBuilder also uses the Connection, CommandTimeout, and Transaction properties referenced by the SelectCommand. The user should call RefreshSchema if any of these properties are modified, or if the SelectCommand itself is replaced. Otherwise the InsertCommand, UpdateCommand, and DeleteCommand properties retain their previous values. If you call Dispose, the MySqlCommandBuilder is disassociated from the MySqlDataAdapter, and the generated commands are no longer used. Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0, database/schema information is not provided to the connector for a query. This means that a query that pulls columns from two identically named tables in two or more different databases will not cause an exception to be thrown but will not work correctly. Even more dangerous is the situation where your select statement references database X but is executed in database Y and both databases have tables with similar layouts. This situation can cause unwanted changes or deletes. This note does not apply to MySQL versions 4.1 and later. The following example uses the , along and , to select rows from a data source. The example is passed an initialized , a connection string, a query string that is a SQL SELECT statement, and a string that is the name of the database table. The example then creates a MySqlCommandBuilder. Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet Dim myConn As New MySqlConnection(myConnection) Dim myDataAdapter As New MySqlDataAdapter() myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn) Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter) myConn.Open() Dim ds As DataSet = New DataSet myDataAdapter.Fill(ds, myTableName) ' Code to modify data in DataSet here ' Without the MySqlCommandBuilder this line would fail. myDataAdapter.Update(ds, myTableName) myConn.Close() End Function 'SelectRows public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName) { MySqlConnection myConn = new MySqlConnection(myConnection); MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(); myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn); MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter); myConn.Open(); DataSet ds = new DataSet(); myDataAdapter.Fill(ds, myTableName); //code to modify data in DataSet here //Without the MySqlCommandBuilder this line would fail myDataAdapter.Update(ds, myTableName); myConn.Close(); return ds; } Initializes a new instance of the class. Initializes a new instance of the class with the associated object. The to use. The registers itself as a listener for events that are generated by the specified in this property. When you create a new instance MySqlCommandBuilder, any existing MySqlCommandBuilder associated with this MySqlDataAdapter is released. Retrieves parameter information from the stored procedure specified in the MySqlCommand and populates the Parameters collection of the specified MySqlCommand object. This method is not currently supported since stored procedures are not available in MySql. The MySqlCommand referencing the stored procedure from which the parameter information is to be derived. The derived parameters are added to the Parameters collection of the MySqlCommand. The command text is not a valid stored procedure name. Gets the delete command. Gets the update command. Gets the insert command. Gets or sets a object for which SQL statements are automatically generated. A object. The registers itself as a listener for events that are generated by the specified in this property. When you create a new instance MySqlCommandBuilder, any existing MySqlCommandBuilder associated with this MySqlDataAdapter is released. This class is modeled after .NET Stopwatch. It provides better performance (no system calls).It is however less precise than .NET Stopwatch, measuring in milliseconds. It is adequate to use when high-precision is not required (e.g for measuring IO timeouts), but not for other tasks. Helper class that makes it easier to work with the provider. Executes a single command against a MySQL database. The is assumed to be open when the method is called and remains open after the method completes. object to use SQL command to be executed Array of objects to use with the command. Executes a single command against a MySQL database. A new is created using the given. to use SQL command to be executed Array of objects to use with the command. Executes a single SQL command and returns the first row of the resultset. A new MySqlConnection object is created, opened, and closed during this method. Settings to be used for the connection Command to execute Parameters to use for the command DataRow containing the first row of the resultset Executes a single SQL command and returns the resultset in a . A new MySqlConnection object is created, opened, and closed during this method. Settings to be used for the connection Command to execute containing the resultset Executes a single SQL command and returns the resultset in a . A new MySqlConnection object is created, opened, and closed during this method. Settings to be used for the connection Command to execute Parameters to use for the command containing the resultset Executes a single SQL command and returns the resultset in a . The state of the object remains unchanged after execution of this method. object to use Command to execute containing the resultset Executes a single SQL command and returns the resultset in a . The state of the object remains unchanged after execution of this method. object to use Command to execute Parameters to use for the command containing the resultset Updates the given table with data from the given Settings to use for the update Command text to use for the update containing the new data to use in the update Tablename in the dataset to update Executes a single command against a MySQL database, possibly inside an existing transaction. object to use for the command object to use for the command Command text to use Array of objects to use with the command True if the connection should be preserved, false if not object ready to read the results of the command Executes a single command against a MySQL database. Settings to use for this command Command text to use object ready to read the results of the command Executes a single command against a MySQL database. Settings to use for this command Command text to use Array of objects to use with the command object ready to read the results of the command Execute a single command against a MySQL database. Settings to use for the update Command text to use for the update The first column of the first row in the result set, or a null reference if the result set is empty. Execute a single command against a MySQL database. Settings to use for the command Command text to use for the command Parameters to use for the command The first column of the first row in the result set, or a null reference if the result set is empty. Execute a single command against a MySQL database. object to use Command text to use for the command The first column of the first row in the result set, or a null reference if the result set is empty. Execute a single command against a MySQL database. object to use Command text to use for the command Parameters to use for the command The first column of the first row in the result set, or a null reference if the result set is empty. Escapes the string. The string to escape The string with all quotes escaped. Summary description for MySqlUInt64. Return schema information about procedures and functions Restrictions supported are: schema, name, type Return schema information about parameters for procedures and functions Restrictions supported are: schema, name, type, parameter name Initializes a new row for the procedure parameters table. Parses out the elements of a procedure parameter data type. Represents an open connection to a MySQL Server database. This class cannot be inherited. A MySqlConnection object represents a session to a MySQL Server data source. When you create an instance of MySqlConnection, all properties are set to their initial values. For a list of these values, see the MySqlConnection constructor. If the MySqlConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling or . The following example creates a and a MySqlConnection. The MySqlConnection is opened and set as the for the MySqlCommand. The example then calls , 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 Sub InsertRow(myConnectionString As String) ' If the connection string is null, use a default. If myConnectionString = "" Then myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass" End If Dim myConnection As New MySqlConnection(myConnectionString) Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)" Dim myCommand As New MySqlCommand(myInsertQuery) myCommand.Connection = myConnection myConnection.Open() myCommand.ExecuteNonQuery() myCommand.Connection.Close() End Sub public void InsertRow(string myConnectionString) { // If the connection string is null, use a default. if(myConnectionString == "") { myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"; } MySqlConnection myConnection = new MySqlConnection(myConnectionString); string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"; MySqlCommand myCommand = new MySqlCommand(myInsertQuery); myCommand.Connection = myConnection; myConnection.Open(); myCommand.ExecuteNonQuery(); myCommand.Connection.Close(); } Initializes a new instance of the class. When a new instance of is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the property. Properties Initial Value empty string ("") 15 empty string ("") empty string ("") empty string ("") You can change the value for these properties only by using the ConnectionString property. Initializes a new instance of the class. Initializes a new instance of the class when given a string containing the connection string. When a new instance of is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the property. Properties Initial Value empty string ("") 15 empty string ("") empty string ("") empty string ("") You can change the value for these properties only by using the ConnectionString property. The connection properties used to open the MySQL database. Enlists in the specified transaction. A reference to an existing in which to enlist. Begins a database transaction.An object representing the new transaction.Parallel transactions are not supported. This command is equivalent to the MySQL BEGIN TRANSACTION command. You must explicitly commit or roll back the transaction using the or method. If you do not specify an isolation level, the default isolation level is used. To specify an isolation level with the method, use the overload that takes the iso parameter. Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher. On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status. The following example creates a and a . It also demonstrates how to use the BeginTransaction, a , and methods. Public Sub RunTransaction(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() Dim myCommand As MySqlCommand = myConnection.CreateCommand() Dim myTrans As MySqlTransaction ' Start a local transaction myTrans = myConnection.BeginTransaction() ' Must assign both transaction object and connection ' to Command object for a pending local transaction myCommand.Connection = myConnection myCommand.Transaction = myTrans Try myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')" myCommand.ExecuteNonQuery() myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')" myCommand.ExecuteNonQuery() myTrans.Commit() Console.WriteLine("Both records are written to database.") Catch e As Exception Try myTrans.Rollback() Catch ex As MySqlException If Not myTrans.Connection Is Nothing Then Console.WriteLine("An exception of type " + ex.GetType().ToString() + _ " was encountered while attempting to roll back the transaction.") End If End Try Console.WriteLine("An exception of type " + e.GetType().ToString() + _ "was encountered while inserting the data.") Console.WriteLine("Neither record was written to database.") Finally myConnection.Close() End Try End Sub public void RunTransaction(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MySqlCommand myCommand = myConnection.CreateCommand(); MySqlTransaction myTrans; // Start a local transaction myTrans = myConnection.BeginTransaction(); // Must assign both transaction object and connection // to Command object for a pending local transaction myCommand.Connection = myConnection; myCommand.Transaction = myTrans; try { myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')"; myCommand.ExecuteNonQuery(); myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')"; myCommand.ExecuteNonQuery(); myTrans.Commit(); Console.WriteLine("Both records are written to database."); } catch(Exception e) { try { myTrans.Rollback(); } catch (SqlException ex) { if (myTrans.Connection != null) { Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction."); } } Console.WriteLine("An exception of type " + e.GetType() + " was encountered while inserting the data."); Console.WriteLine("Neither record was written to database."); } finally { myConnection.Close(); } } Begins a database transaction with the specified isolation level.The isolation level under which the transaction should run. An object representing the new transaction.Parallel exceptions are not supported. This command is equivalent to the MySQL BEGIN TRANSACTION command. You must explicitly commit or roll back the transaction using the or method. If you do not specify an isolation level, the default isolation level is used. To specify an isolation level with the method, use the overload that takes the iso parameter. Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher. On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status. The following example creates a and a . It also demonstrates how to use the BeginTransaction, a , and methods. Public Sub RunTransaction(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() Dim myCommand As MySqlCommand = myConnection.CreateCommand() Dim myTrans As MySqlTransaction ' Start a local transaction myTrans = myConnection.BeginTransaction() ' Must assign both transaction object and connection ' to Command object for a pending local transaction myCommand.Connection = myConnection myCommand.Transaction = myTrans Try myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')" myCommand.ExecuteNonQuery() myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')" myCommand.ExecuteNonQuery() myTrans.Commit() Console.WriteLine("Both records are written to database.") Catch e As Exception Try myTrans.Rollback() Catch ex As MySqlException If Not myTrans.Connection Is Nothing Then Console.WriteLine("An exception of type " + ex.GetType().ToString() + _ " was encountered while attempting to roll back the transaction.") End If End Try Console.WriteLine("An exception of type " + e.GetType().ToString() + _ "was encountered while inserting the data.") Console.WriteLine("Neither record was written to database.") Finally myConnection.Close() End Try End Sub public void RunTransaction(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MySqlCommand myCommand = myConnection.CreateCommand(); MySqlTransaction myTrans; // Start a local transaction myTrans = myConnection.BeginTransaction(); // Must assign both transaction object and connection // to Command object for a pending local transaction myCommand.Connection = myConnection; myCommand.Transaction = myTrans; try { myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')"; myCommand.ExecuteNonQuery(); myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')"; myCommand.ExecuteNonQuery(); myTrans.Commit(); Console.WriteLine("Both records are written to database."); } catch(Exception e) { try { myTrans.Rollback(); } catch (SqlException ex) { if (myTrans.Connection != null) { Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction."); } } Console.WriteLine("An exception of type " + e.GetType() + " was encountered while inserting the data."); Console.WriteLine("Neither record was written to database."); } finally { myConnection.Close(); } } Changes the current database for an open MySqlConnection.The name of the database to use. The value supplied in the database parameter must be a valid database name. The database parameter cannot contain a null value, an empty string, or a string with only blank characters. When you are using connection pooling against MySQL, and you close the connection, it is returned to the connection pool. The next time the connection is retrieved from the pool, the reset connection request executes before the user performs any operations. The database name is not valid.The connection is not open.Cannot change the database. The following example creates a and displays some of its read-only properties. Public Sub CreateMySqlConnection() Dim myConnString As String = _ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass" Dim myConnection As New MySqlConnection( myConnString ) myConnection.Open() MessageBox.Show( "Server Version: " + myConnection.ServerVersion _ + ControlChars.NewLine + "Database: " + myConnection.Database ) myConnection.ChangeDatabase( "test2" ) MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _ + ControlChars.NewLine + "Database: " + myConnection.Database ) myConnection.Close() End Sub public void CreateMySqlConnection() { string myConnString = "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"; MySqlConnection myConnection = new MySqlConnection( myConnString ); myConnection.Open(); MessageBox.Show( "Server Version: " + myConnection.ServerVersion + "\nDatabase: " + myConnection.Database ); myConnection.ChangeDatabase( "test2" ); MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion + "\nDatabase: " + myConnection.Database ); myConnection.Close(); } Ping Opens a database connection with the property settings specified by the ConnectionString.Cannot open a connection without specifying a data source or server.A connection-level error occurred while opening the connection. The draws an open connection from the connection pool if one is available. Otherwise, it establishes a new connection to an instance of MySQL. The following example creates a , opens it, displays some of its properties, then closes the connection. Public Sub CreateMySqlConnection(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + ControlChars.Cr + "State: " + myConnection.State.ToString()) myConnection.Close() End Sub public void CreateMySqlConnection(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + "\nState: " + myConnection.State.ToString()); myConnection.Close(); } Creates and returns a object associated with the . A object. Creates a new MySqlConnection object with the exact same ConnectionString value A cloned MySqlConnection object Closes the connection to the database. This is the preferred method of closing any open connection. The Close method rolls back any pending transactions. It then releases the connection to the connection pool, or closes the connection if connection pooling is disabled. An application can call Close more than one time. No exception is generated. The following example creates a , opens it, displays some of its properties, then closes the connection. Public Sub CreateMySqlConnection(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + ControlChars.Cr + "State: " + myConnection.State.ToString()) myConnection.Close() End Sub public void CreateMySqlConnection(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + "\nState: " + myConnection.State.ToString()); myConnection.Close(); } Sets query timeout. If timeout has been set prior and not yet cleared ClearCommandTimeout(), it has no effect. timeout in seconds true if Clears query timeout, allowing next SetCommandTimeout() to succeed. Returns schema information for the data source of this . A that contains schema information. Returns schema information for the data source of this using the specified string for the schema name. Specifies the name of the schema to return. A that contains schema information. Returns schema information for the data source of this using the specified string for the schema name and the specified string array for the restriction values. Specifies the name of the schema to return. Specifies a set of restriction values for the requested schema. A that contains schema information. Empties the connection pool associated with the specified connection. The associated with the pool to be cleared. ClearPool clears the connection pool that is associated with the connection. If additional connections associated with connection are in use at the time of the call, they are marked appropriately and are discarded (instead of being returned to the pool) when Close is called on them. Clears all connection pools. ClearAllPools essentially performs a on all current connection pools. Occurs when MySQL returns warnings as a result of executing a command or query. Returns the id of the server thread this connection is executing on Gets the name of the MySQL server to which to connect. Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error. The value set is less than 0. A value of 0 indicates no limit, and should be avoided in a because an attempt to connect will wait indefinitely. The following example creates a MySqlConnection and sets some of its properties in the connection string. Public Sub CreateSqlConnection() Dim myConnection As New MySqlConnection() myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30" myConnection.Open() End Sub public void CreateSqlConnection() { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"; myConnection.Open(); } Gets the name of the current database or the database to be used after a connection is opened.The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string. The Database property does not update dynamically. If you change the current database using a SQL statement, then this property may reflect the wrong value. If you change the current database using the method, this property is updated to reflect the new database. The following example creates a and displays some of its read-only properties. Public Sub CreateMySqlConnection() Dim myConnString As String = _ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass" Dim myConnection As New MySqlConnection( myConnString ) myConnection.Open() MessageBox.Show( "Server Version: " + myConnection.ServerVersion _ + ControlChars.NewLine + "Database: " + myConnection.Database ) myConnection.ChangeDatabase( "test2" ) MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _ + ControlChars.NewLine + "Database: " + myConnection.Database ) myConnection.Close() End Sub public void CreateMySqlConnection() { string myConnString = "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"; MySqlConnection myConnection = new MySqlConnection( myConnString ); myConnection.Open(); MessageBox.Show( "Server Version: " + myConnection.ServerVersion + "\nDatabase: " + myConnection.Database ); myConnection.ChangeDatabase( "test2" ); MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion + "\nDatabase: " + myConnection.Database ); myConnection.Close(); } Indicates if this connection should use compression when communicating with the server. Gets the current state of the connection. A bitwise combination of the values. The default is Closed. The allowed state changes are: From Closed to Open, using the Open method of the connection object. From Open to Closed, using either the Close method or the Dispose method of the connection object. The following example creates a , opens it, displays some of its properties, then closes the connection. Public Sub CreateMySqlConnection(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + ControlChars.Cr + "State: " + myConnection.State.ToString()) myConnection.Close() End Sub public void CreateMySqlConnection(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + "\nState: " + myConnection.State.ToString()); myConnection.Close(); } Gets a string containing the version of the MySQL server to which the client is connected.The version of the instance of MySQL.The connection is closed. The following example creates a , opens it, displays some of its properties, then closes the connection. Public Sub CreateMySqlConnection(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + ControlChars.Cr + "State: " + myConnection.State.ToString()) myConnection.Close() End Sub public void CreateMySqlConnection(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + "\nState: " + myConnection.State.ToString()); myConnection.Close(); } Gets or sets the string used to connect to a MySQL Server database. The ConnectionString returned may not be exactly like what was originally set but will be indentical in terms of keyword/value pairs. Security information will not be included unless the Persist Security Info value is set to true. You can use the ConnectionString property to connect to a database. The following example illustrates a typical connection string. "Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass" The ConnectionString property can be set only when the connection is closed. Many of the connection string values have corresponding read-only properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated. properties return only those settings contained in the ConnectionString. To connect to a local machine, specify "localhost" for the server. If you do not specify a server, localhost is assumed. Resetting the ConnectionString on a closed connection resets all connection string values (and related properties) including the password. For example, if you set a connection string that includes "Database= MyDb", and then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass", the property is no longer set to MyDb. The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as , is generated. Other errors can be found only when an attempt is made to open the connection. The basic format of a connection string consists of a series of keyword/value pairs separated by semicolons. The equal sign (=) connects each keyword and its value. To include values that contain a semicolon, single-quote character, or double-quote character, the value must be enclosed in double quotes. If the value contains both a semicolon and a double-quote character, the value can be enclosed in single quotes. The single quote is also useful if the value begins with a double-quote character. Conversely, the double quote can be used if the value begins with a single quote. If the value contains both single-quote and double-quote characters, the quote character used to enclose the value must be doubled each time it occurs within the value. To include preceding or trailing spaces in the string value, the value must be enclosed in either single quotes or double quotes. Any leading or trailing spaces around integer, Boolean, or enumerated values are ignored, even if enclosed in quotes. However, spaces within a string literal keyword or value are preserved. Using .NET Framework version 1.1, single or double quotes may be used within a connection string without using delimiters (for example, Data Source= my'Server or Data Source= my"Server), unless a quote character is the first or last character in the value. To include an equal sign (=) in a keyword or value, it must be preceded by another equal sign. For example, in the hypothetical connection string "key==word=value" the keyword is "key=word" and the value is "value". If a specific keyword in a keyword= value pair occurs multiple times in a connection string, the last occurrence listed is used in the value set. Keywords are not case sensitive. The following table lists the valid names for keyword values within the ConnectionString.
Name Default Description
Connect Timeout -or- Connection Timeout 15 The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.
Host -or- Server -or- Data Source -or- DataSource -or- Address -or- Addr -or- Network Address localhost The name or network address of the instance of MySQL to which to connect. Multiple hosts can be specified separated by &. This can be useful where multiple MySQL servers are configured for replication and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to synchronize writes to the database so care should be taken when using this option. In Unix environment with Mono, this can be a fully qualified path to MySQL socket filename. With this configuration, the Unix socket will be used instead of TCP/IP socket. Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
Port 3306 The port MySQL is using to listen for connections. This value is ignored if the connection protocol is anything but socket.
Protocol socket Specifies the type of connection to make to the server.Values can be: socket or tcp for a socket connection
pipe for a named pipe connection
unix for a Unix socket connection
memory to use MySQL shared memory
CharSet -or Character Set Specifies the character set that should be used to encode all queries sent to the server. Resultsets are still returned in the character set of the data returned.
Logging false When true, various pieces of information is output to any configured TraceListeners.
Allow Batch true When true, multiple SQL statements can be sent with one command execution.

-Note-
Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.
Commands sent to earlier versions of MySQL should be seperated with ';'.
Encrypt false When true, SSL/TLS encryption is used for all data sent between the client and server if the server has a certificate installed. Recognized values are true, false, yes, and no.
Initial Catalog -or- Database mysql The name of the database to use intially
Password -or- pwd The password for the MySQL account being used.
Persist Security Info false When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.
User Id -or- Username -or- Uid -or- User name The MySQL login account being used.
Shared Memory Name MYSQL The name of the shared memory object to use for communication if the connection protocol is set to memory.
Allow Zero Datetime false True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values. False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values.
Convert Zero Datetime false True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime() return DateTime.MinValue for date or datetime columns that have illegal values.
Pipe Name -or- Pipe mysql When set to the name of a named pipe, the MySqlConnection will attempt to connect to MySQL on that named pipe.

This settings only applies to the Windows platform.
Use Performance Monitor -or- UsePerformanceMonitor false Posts performance data that can be tracked using perfmon
Procedure Cache Size 25 How many stored procedure definitions can be held in the cache
Ignore Prepare true Instructs the provider to ignore any attempts to prepare commands. This option was added to allow a user to disable prepared statements in an entire application without modifying the code. A user might want to do this if errors or bugs are encountered with MySQL prepared statements.
Use Procedure Bodies true Instructs the provider to attempt to call the procedure without first resolving the metadata. This is useful in situations where the calling user does not have access to the mysql.proc table. To use this mode, the parameters for the procedure must be added to the command in the same order as they appear in the procedure definition and their types must be explicitly set.
Auto Enlist true Indicates whether the connection should automatically enlist in the current transaction, if there is one.
Respect Binary Flags true Indicates whether the connection should respect all binary flags sent to the client as part of column metadata. False will cause the connector to behave like Connector/Net 5.0 and earlier.
BlobAsUTF8IncludePattern null Pattern that should be used to indicate which blob columns should be treated as UTF-8.
BlobAsUTF8ExcludePattern null Pattern that should be used to indicate which blob columns should not be treated as UTF-8.
Default Command Timeout 30 The default timeout that new MySqlCommand objects will use unless changed.
Allow User Variables false Should the provider expect user variables in the SQL.
Interactive -or- Interactive Session false Should this session be considered interactive?
Functions Return String false Set this option to true to force the return value of SQL functions to be string.
Use Affected Rows false Set this option to true to cause the affected rows reported to reflect only the rows that are actually changed. By default, the number of rows that are matched is returned.
The following table lists the valid names for connection pooling values within the ConnectionString. For more information about connection pooling, see Connection Pooling for the MySql Data Provider.
Name Default Description
Connection Lifetime 0 When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online. A value of zero (0) causes pooled connections to have the maximum connection timeout.
Max Pool Size 100 The maximum number of connections allowed in the pool.
Min Pool Size 0 The minimum number of connections allowed in the pool.
Pooling true When true, the MySqlConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool. Recognized values are true, false, yes, and no.
Connection Reset false Specifies whether the database connection should be reset when being drawn from the pool. Leaving this as false will yeild much faster connection opens but the user should understand the side effects of doing this such as temporary tables and user variables from the previous session not being cleared out.
When setting keyword or connection pooling values that require a Boolean value, you can use 'yes' instead of 'true', and 'no' instead of 'false'. Note The MySql Data Provider uses the native socket protocol to communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when connecting to MySQL because it does not add an ODBC layer. CAUTION In this release, the application should use caution when constructing a connection string based on user input (for example when retrieving user ID and password information from a dialog box, and appending it to the connection string). The application should ensure that a user cannot embed extra connection string parameters in these values (for example, entering a password as "validpassword;database=somedb" in an attempt to attach to a different database).
The following example creates a and sets some of its properties Public Sub CreateConnection() Dim myConnection As New MySqlConnection() myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass" myConnection.Open() End Sub 'CreateConnection public void CreateConnection() { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"; myConnection.Open(); } The following example creates a in Unix environment with Mono installed. MySQL socket filename used in this example is "/var/lib/mysql/mysql.sock". The actual filename depends on your MySQL configuration. Public Sub CreateConnection() Dim myConnection As New MySqlConnection() myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass" myConnection.Open() End Sub 'CreateConnection public void CreateConnection() { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"; myConnection.Open(); }
Represents the method that will handle the event of a . Provides data for the InfoMessage event. This class cannot be inherited. IDisposable wrapper around SetCommandTimeout and ClearCommandTimeout functionality Summary description for MySqlStream. ReadPacket is called by NativeDriver to start reading the next packet on the stream. Reads the specified number of bytes from the stream and stores them at given offset in the buffer. Throws EndOfStreamException if not all bytes can be read. Stream to read from Array to store bytes read from the stream The offset in buffer at which to begin storing the data read from the current stream. Number of bytes to read LoadPacket loads up and decodes the header of the incoming packet. 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. The MySQLDataAdapter, serves as a bridge between a and MySQL for retrieving and saving data. The MySQLDataAdapter provides this bridge by mapping , which changes the data in the DataSet to match the data in the data source, and , which changes the data in the data source to match the data in the DataSet, using the appropriate SQL statements against the data source. When the MySQLDataAdapter fills a 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 property is set to . You may also have the MySQLDataAdapter create the schema of the DataSet, including primary key information, before filling it with data using . MySQLDataAdapter is used in conjunction with and to increase performance when connecting to a MySQL database. The MySQLDataAdapter also includes the , , , , and 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. Please be aware that the 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. The following example creates a and a . The MySqlConnection is opened and set as the for the MySqlCommand. The example then calls , 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 Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet Dim conn As New MySqlConnection(connection) Dim adapter As New MySqlDataAdapter() adapter.SelectCommand = new MySqlCommand(query, conn) adapter.Fill(dataset) Return dataset End Function 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; } Initializes a new instance of the MySqlDataAdapter class. When an instance of is created, the following read/write properties are set to the following initial values. Properties Initial Value MissingMappingAction.Passthrough MissingSchemaAction.Add You can change the value of any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateSqlDataAdapter() Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ "database=test") Dim da As MySqlDataAdapter = New MySqlDataAdapter da.MissingSchemaAction = MissingSchemaAction.AddWithKey da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn) da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ "VALUES (@id, @name)", conn) da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ "WHERE id=@oldId", conn) da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original End Sub public static void CreateSqlDataAdapter() { MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); MySqlDataAdapter da = new MySqlDataAdapter(); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn); da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + "VALUES (@id, @name)", conn); da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + "WHERE id=@oldId", conn); da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; } Initializes a new instance of the class with the specified as the property. that is a SQL SELECT statement or stored procedure and is set as the property of the . When an instance of is created, the following read/write properties are set to the following initial values. Properties Initial Value MissingMappingAction.Passthrough MissingSchemaAction.Add You can change the value of any of these properties through a separate call to the property. When SelectCommand (or any of the other command properties) is assigned to a previously created , the MySqlCommand is not cloned. The SelectCommand maintains a reference to the previously created MySqlCommand object. The following example creates a and sets some of its properties. Public Sub CreateSqlDataAdapter() Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ "database=test") Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn) Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd) da.MissingSchemaAction = MissingSchemaAction.AddWithKey da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ "VALUES (@id, @name)", conn) da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ "WHERE id=@oldId", conn) da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original End Sub public static void CreateSqlDataAdapter() { MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + "VALUES (@id, @name)", conn); da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + "WHERE id=@oldId", conn); da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; } Initializes a new instance of the class with a and a object. A String that is a SQL SELECT statement or stored procedure to be used by the property of the . A that represents the connection. This implementation of the opens and closes a if it is not already open. This can be useful in a an application that must call the method for two or more MySqlDataAdapter objects. If the MySqlConnection is already open, you must explicitly call or to close it. When an instance of is created, the following read/write properties are set to the following initial values. Properties Initial Value MissingMappingAction.Passthrough MissingSchemaAction.Add You can change the value of any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateSqlDataAdapter() Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ "database=test") Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn) da.MissingSchemaAction = MissingSchemaAction.AddWithKey da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ "VALUES (@id, @name)", conn) da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ "WHERE id=@oldId", conn) da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original End Sub public static void CreateSqlDataAdapter() { MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + "VALUES (@id, @name)", conn); da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + "WHERE id=@oldId", conn); da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; } Initializes a new instance of the class with a and a connection string. A that is a SQL SELECT statement or stored procedure to be used by the property of the . The connection string When an instance of is created, the following read/write properties are set to the following initial values. Properties Initial Value MissingMappingAction.Passthrough MissingSchemaAction.Add You can change the value of any of these properties through a separate call to the property. The following example creates a and sets some of its properties. Public Sub CreateSqlDataAdapter() Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test") Dim conn As MySqlConnection = da.SelectCommand.Connection da.MissingSchemaAction = MissingSchemaAction.AddWithKey da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ "VALUES (@id, @name)", conn) da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ "WHERE id=@oldId", conn) da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original End Sub public static void CreateSqlDataAdapter() { MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test"); MySqlConnection conn = da.SelectCommand.Connection; da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + "VALUES (@id, @name)", conn); da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + "WHERE id=@oldId", conn); da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; } Overridden. See . Overridden. See . Overridden. Raises the RowUpdating event. A MySqlRowUpdatingEventArgs that contains the event data. Overridden. Raises the RowUpdated event. A MySqlRowUpdatedEventArgs that contains the event data. Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires. Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires. Gets or sets a SQL statement or stored procedure used to delete records from the data set. A used during to delete records in the database that correspond to deleted rows in the . During , if this property is not set and primary key information is present in the , the DeleteCommand can be generated automatically if you set the property and use the . 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 , the MySqlCommand is not cloned. The DeleteCommand maintains a reference to the previously created MySqlCommand object. The following example creates a and sets the and DeleteCommand properties. It assumes you have already created a object. 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 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; } Gets or sets a SQL statement or stored procedure used to insert records into the data set. A used during to insert records into the database that correspond to new rows in the . During , if this property is not set and primary key information is present in the , the InsertCommand can be generated automatically if you set the property and use the . 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 , the MySqlCommand is not cloned. The InsertCommand maintains a reference to the previously created MySqlCommand object. If execution of this command returns rows, these rows may be added to the DataSet depending on how you set the property of the MySqlCommand object. The following example creates a and sets the and InsertCommand properties. It assumes you have already created a object. 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 InsertCommand. cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn) cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) da.InsertCommand = cmd Return da End Function 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 InsertCommand. cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn); cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); da.InsertCommand = cmd; return da; } Gets or sets a SQL statement or stored procedure used to select records in the data source. A used during to select records from the database for placement in the . When SelectCommand is assigned to a previously created , 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 , and no exception is raised. The following example creates a and sets the and InsertCommand properties. It assumes you have already created a object. 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 InsertCommand. cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn) cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) da.InsertCommand = cmd Return da End Function 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 InsertCommand. cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn); cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); da.InsertCommand = cmd; return da; } Gets or sets a SQL statement or stored procedure used to updated records in the data source. A used during to update records in the database with data from the . During , if this property is not set and primary key information is present in the , the UpdateCommand can be generated automatically if you set the property and use the . 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 , the MySqlCommand is not cloned. The UpdateCommand maintains a reference to the previously created MySqlCommand object. If execution of this command returns rows, these rows may be merged with the DataSet depending on how you set the property of the MySqlCommand object. The following example creates a and sets the and UpdateCommand properties. It assumes you have already created a object. 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 UpdateCommand. cmd = New MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn) cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) parm = cmd.Parameters.Add("@oldId", MySqlDbType.VarChar, 15, "id") parm.SourceVersion = DataRowVersion.Original da.UpdateCommand = cmd Return da End Function 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 UpdateCommand. cmd = new MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn); cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); parm = cmd.Parameters.Add( "@oldId", MySqlDbType.VarChar, 15, "id" ); parm.SourceVersion = DataRowVersion.Original; da.UpdateCommand = cmd; return da; } Represents the method that will handle the event of a . Represents the method that will handle the event of a . Provides data for the RowUpdating event. This class cannot be inherited. Initializes a new instance of the MySqlRowUpdatingEventArgs class. The to . The to execute during . One of the values that specifies the type of query executed. The sent through an . Gets or sets the MySqlCommand to execute when performing the Update. Provides data for the RowUpdated event. This class cannot be inherited. Initializes a new instance of the MySqlRowUpdatedEventArgs class. The sent through an . The executed when is called. One of the values that specifies the type of query executed. The sent through an . Gets or sets the MySqlCommand executed when Update is called. Summary description for StreamCreator. Set keepalive + timeout on socket. socket keepalive timeout, in seconds Represents a SQL transaction to be made in a MySQL database. This class cannot be inherited. The application creates a MySqlTransaction object by calling on the object. All subsequent operations associated with the transaction (for example, committing or aborting the transaction), are performed on the MySqlTransaction object. The following example creates a and a MySqlTransaction. It also demonstrates how to use the , , and methods. Public Sub RunTransaction(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() Dim myCommand As MySqlCommand = myConnection.CreateCommand() Dim myTrans As MySqlTransaction ' Start a local transaction myTrans = myConnection.BeginTransaction() ' Must assign both transaction object and connection ' to Command object for a pending local transaction myCommand.Connection = myConnection myCommand.Transaction = myTrans Try myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')" myCommand.ExecuteNonQuery() myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')" myCommand.ExecuteNonQuery() myTrans.Commit() Console.WriteLine("Both records are written to database.") Catch e As Exception Try myTrans.Rollback() Catch ex As MySqlException If Not myTrans.Connection Is Nothing Then Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ " was encountered while attempting to roll back the transaction.") End If End Try Console.WriteLine("An exception of type " & e.GetType().ToString() & _ "was encountered while inserting the data.") Console.WriteLine("Neither record was written to database.") Finally myConnection.Close() End Try End Sub 'RunTransaction public void RunTransaction(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MySqlCommand myCommand = myConnection.CreateCommand(); MySqlTransaction myTrans; // Start a local transaction myTrans = myConnection.BeginTransaction(); // Must assign both transaction object and connection // to Command object for a pending local transaction myCommand.Connection = myConnection; myCommand.Transaction = myTrans; try { myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"; myCommand.ExecuteNonQuery(); myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"; myCommand.ExecuteNonQuery(); myTrans.Commit(); Console.WriteLine("Both records are written to database."); } catch(Exception e) { try { myTrans.Rollback(); } catch (MySqlException ex) { if (myTrans.Connection != null) { Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction."); } } Console.WriteLine("An exception of type " + e.GetType() + " was encountered while inserting the data."); Console.WriteLine("Neither record was written to database."); } finally { myConnection.Close(); } } Commits the database transaction. The Commit method is equivalent to the MySQL SQL statement COMMIT. The following example creates a and a . It also demonstrates how to use the , , and Rollback methods. Public Sub RunSqlTransaction(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() Dim myCommand As MySqlCommand = myConnection.CreateCommand() Dim myTrans As MySqlTransaction ' Start a local transaction myTrans = myConnection.BeginTransaction() ' Must assign both transaction object and connection ' to Command object for a pending local transaction myCommand.Connection = myConnection myCommand.Transaction = myTrans Try myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')" myCommand.ExecuteNonQuery() myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')" myCommand.ExecuteNonQuery() myTrans.Commit() Console.WriteLine("Success.") Catch e As Exception Try myTrans.Rollback() Catch ex As MySqlException If Not myTrans.Connection Is Nothing Then Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ " was encountered while attempting to roll back the transaction.") End If End Try Console.WriteLine("An exception of type " & e.GetType().ToString() & _ "was encountered while inserting the data.") Console.WriteLine("Neither record was written to database.") Finally myConnection.Close() End Try End Sub public void RunSqlTransaction(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MySqlCommand myCommand = myConnection.CreateCommand(); MySqlTransaction myTrans; // Start a local transaction myTrans = myConnection.BeginTransaction(); // Must assign both transaction object and connection // to Command object for a pending local transaction myCommand.Connection = myConnection; myCommand.Transaction = myTrans; try { myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"; myCommand.ExecuteNonQuery(); myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"; myCommand.ExecuteNonQuery(); myTrans.Commit(); Console.WriteLine("Both records are written to database."); } catch(Exception e) { try { myTrans.Rollback(); } catch (MySqlException ex) { if (myTrans.Connection != null) { Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction."); } } Console.WriteLine("An exception of type " + e.GetType() + " was encountered while inserting the data."); Console.WriteLine("Neither record was written to database."); } finally { myConnection.Close(); } } Rolls back a transaction from a pending state. The Rollback method is equivalent to the MySQL statement ROLLBACK. The transaction can only be rolled back from a pending state (after BeginTransaction has been called, but before Commit is called). The following example creates a and a . It also demonstrates how to use the , , and Rollback methods. Public Sub RunSqlTransaction(myConnString As String) Dim myConnection As New MySqlConnection(myConnString) myConnection.Open() Dim myCommand As MySqlCommand = myConnection.CreateCommand() Dim myTrans As MySqlTransaction ' Start a local transaction myTrans = myConnection.BeginTransaction() ' Must assign both transaction object and connection ' to Command object for a pending local transaction myCommand.Connection = myConnection myCommand.Transaction = myTrans Try myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')" myCommand.ExecuteNonQuery() myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')" myCommand.ExecuteNonQuery() myTrans.Commit() Console.WriteLine("Success.") Catch e As Exception Try myTrans.Rollback() Catch ex As MySqlException If Not myTrans.Connection Is Nothing Then Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ " was encountered while attempting to roll back the transaction.") End If End Try Console.WriteLine("An exception of type " & e.GetType().ToString() & _ "was encountered while inserting the data.") Console.WriteLine("Neither record was written to database.") Finally myConnection.Close() End Try End Sub public void RunSqlTransaction(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MySqlCommand myCommand = myConnection.CreateCommand(); MySqlTransaction myTrans; // Start a local transaction myTrans = myConnection.BeginTransaction(); // Must assign both transaction object and connection // to Command object for a pending local transaction myCommand.Connection = myConnection; myCommand.Transaction = myTrans; try { myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"; myCommand.ExecuteNonQuery(); myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"; myCommand.ExecuteNonQuery(); myTrans.Commit(); Console.WriteLine("Both records are written to database."); } catch(Exception e) { try { myTrans.Rollback(); } catch (MySqlException ex) { if (myTrans.Connection != null) { Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction."); } } Console.WriteLine("An exception of type " + e.GetType() + " was encountered while inserting the data."); Console.WriteLine("Neither record was written to database."); } finally { myConnection.Close(); } } Gets the object associated with the transaction, or a null reference (Nothing in Visual Basic) if the transaction is no longer valid. The object associated with this transaction. A single application may have multiple database connections, each with zero or more transactions. This property enables you to determine the connection object associated with a particular transaction created by . Specifies the for this transaction. The for this transaction. The default is ReadCommitted. Parallel transactions are not supported. Therefore, the IsolationLevel applies to the entire transaction. Gets or sets the name of the server. The server. Gets or sets the name of the database the connection should initially connect to. Gets or sets the protocol that should be used for communicating with MySQL. Gets or sets the name of the named pipe that should be used for communicating with MySQL. Gets or sets a boolean value that indicates whether this connection should use compression. Gets or sets a boolean value that indicates whether this connection will allow commands to send multiple SQL statements in one execution. Gets or sets a boolean value that indicates whether logging is enabled. Gets or sets the base name of the shared memory objects used to communicate with MySQL when the shared memory protocol is being used. Gets or sets a boolean value that indicates whether this connection uses the old style (@) parameter markers or the new (?) style. Gets or sets the port number that is used when the socket protocol is being used. Gets or sets the connection timeout. Gets or sets the default command timeout. Gets or sets the user id that should be used to connect with. Gets or sets the password that should be used to connect with. Gets or sets a boolean value that indicates if the password should be persisted in the connection string. Gets or sets a boolean value that indicates if zero date time values are supported. Gets or sets a boolean value indicating if zero datetime values should be converted to DateTime.MinValue. Gets or sets a boolean value indicating if the Usage Advisor should be enabled. Gets or sets the size of the stored procedure cache. Gets or sets a boolean value indicating if the permon hooks should be enabled. Gets or sets a boolean value indicating if calls to Prepare() should be ignored. Gets or sets the lifetime of a pooled connection. Gets or sets a boolean value indicating if connection pooling is enabled. Gets the minimum connection pool size. Gets or sets the maximum connection pool setting. Gets or sets a boolean value indicating if the connection should be reset when retrieved from the pool. Gets or sets the character set that should be used for sending queries to the server. Indicates whether the driver should treat binary blobs as UTF8 Gets or sets the pattern that matches the columns that should be treated as UTF8 Gets or sets the pattern that matches the columns that should not be treated as UTF8 Indicates whether to use SSL connections and how to handle server certificate errors. Summary description for CharSetMap. Returns the text encoding for a given MySQL character set name Version of the connection requesting the encoding Name of the character set to get the encoding for Encoding object for the given character set name Provides a class capable of executing a SQL script containing multiple SQL statements including CREATE PROCEDURE statements that require changing the delimiter Initializes a new instance of the class. Initializes a new instance of the class. The connection. Initializes a new instance of the class. The query. Initializes a new instance of the class. The connection. The query. Executes this instance. The number of statements executed as part of the script. Gets or sets the connection. The connection. Gets or sets the query. The query. Gets or sets the delimiter. The delimiter. Gets the statement text. The statement text. Gets the line. The line. Gets the position. The position. Initializes a new instance of the class. The exception. Gets the exception. The exception. Gets or sets a value indicating whether this is ignore. true if ignore; otherwise, false. Constructs a new MySqlDateTime object by setting the individual time properties to the given values. The year to use. The month to use. The day to use. The hour to use. The minute to use. The second to use. Constructs a new MySqlDateTime object by using values from the given object. The object to copy. Constructs a new MySqlDateTime object by copying the current value of the given object. The MySqlDateTime object to copy. Enables the contruction of a MySqlDateTime object by parsing a string. Returns this value as a DateTime Returns a MySQL specific string representation of this value Indicates if this object contains a value that can be represented as a DateTime Returns the year portion of this datetime Returns the month portion of this datetime Returns the day portion of this datetime Returns the hour portion of this datetime Returns the minute portion of this datetime Returns the second portion of this datetime Retrieves the millisecond value of this object. Returns true if this datetime object has a null value Retrieves the value of this as a DateTime object. Summary description for Driver. Sets the current database for the this connection Retrieve client SSL certificates. Dependent on connection string settings we use either file or store based certificates. Return the appropriate set of connection flags for our server capabilities and our user requested options. Perform an authentication against a 4.1.1 server Query is the method that is called to send all queries to the server Sends the specified file to the server. This supports the LOAD DATA LOCAL INFILE FetchDataRow is the method that the data reader calls to see if there is another row to fetch. In the non-prepared mode, it will simply read the next data packet. In the prepared mode (statementId > 0), it will Execution timeout, in milliseconds. When the accumulated time for network IO exceeds this value TimeoutException is thrown. This timeout needs to be reset for every new command Summary description for Crypt. Simple XOR scramble Source array Index inside source array Destination array Index inside destination array Password used to xor the bits Number of bytes to scramble Generate a scrambled password for 4.1.0 using new passwords The password to scramble The seedbytes used to scramble Array of bytes containing the scrambled password Generates a proper hash for old style 4.1.0 passwords. This would be used if a 4.1.0 server contained old 16 byte hashes. The password to hash Seed bytes received from the server Byte array containing the password hash Returns a byte array containing the proper encryption of the given password/seed according to the new 4.1.1 authentication scheme. Encrypts a password using the MySql encryption scheme The password to encrypt The encryption seed the server gave us Indicates if we should use the old or new encryption scheme Hashes a password using the algorithm from Monty's code. The first element in the return is the result of the "old" hash. The second element is the rest of the "new" hash. Password to be hashed Two element array containing the hashed values Summary description for API.