| 22.2.7. Connector/Net API Reference This section of the manual contains a complete reference to the Connector/Net ADO.NET component, automatically generated from the embedded documentation. 22.2.7.1. MySql.Data.MySqlClient Namespace Namespace hierarchy Classes Delegates Enumerations 22.2.7.1.2. BaseCommandInterceptor The BaseCommandInterceptor class has these methods that you can override: public virtual bool ExecuteScalar(string sql, ref object returnValue);public virtual bool ExecuteNonQuery(string sql, ref int returnValue);public virtual bool ExecuteReader(string sql, CommandBehavior behavior, ref MySqlDataReader returnValue);public virtual void Init(MySqlConnection connection); If your interceptor overrides one of the Execute... methods, set the returnValue output parameter and return true if you handled the event, or false if you did not handle the event. The SQL command is processed normally only when all command interceptors return false. The connection passed to the Init method is the connection that is attached to this interceptor. For full usage and examples, see Section 22.2.5.11, "Using the Connector/Net Interceptor Classes". 22.2.7.1.3. BaseExceptionInterceptor You develop an exception interceptor first by creating a subclass of the BaseExceptionInterceptor class. You must override the InterceptException() method. You can also override the Init() method to do some one-time initialization. Each exception interceptor has 2 methods: public abstract Exception InterceptException(Exception exception, MySqlConnection connection);public virtual void Init(MySqlConnection connection); The connection passed to Init() is the connection that is attached to this interceptor. Each interceptor is required to override InterceptException and return an exception. It can return the exception it is given, or it can wrap it in a new exception. We currently do not offer the ability to suppress the exception. For full usage and examples, see Section 22.2.5.11, "Using the Connector/Net Interceptor Classes". 22.2.7.1.4. MySqlCommand Class For a list of all members of this type, see MySqlCommand Members. Syntax: Visual Basic NotInheritable Public Class MySqlCommand_ Inherits Component_ Implements IDbCommand, ICloneable Syntax: C# public sealed class MySqlCommand : Component, IDbCommand, ICloneable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlCommand Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1. MySqlCommand Members MySqlCommand overview Public Instance Constructors Public Instance Properties Public Instance Methods Public Instance Events See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1. MySqlCommand Constructor Initializes a new instance of the MySqlCommand class. Overload List Initializes a new instance of the MySqlCommand class. See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3. MySqlCommand Constructor Syntax: Visual Basic Overloads Public Sub New( _ ByVal cmdText As String, _ ByVal connection As MySqlConnection _) Syntax: C# public MySqlCommand(stringcmdText,MySqlConnectionconnection); See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace, MySqlCommand Constructor Overload List 22.2.7.1.4.1.1.3.1. MySqlConnection Class For a list of all members of this type, see MySqlConnection Members . Syntax: Visual Basic NotInheritable Public Class MySqlConnection_ Inherits Component_ Implements IDbConnection, ICloneable Syntax: C# public sealed class MySqlConnection : Component, IDbConnection, ICloneable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlConnection Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1. MySqlConnection Members MySqlConnection overview Public Instance Constructors Public Instance Properties Public Instance Methods Public Instance Events See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.2. ConnectionString Property Syntax: Visual Basic NotOverridable Public Property ConnectionString As String __ Implements IDbConnection.ConnectionString Syntax: C# public string ConnectionString {get; set;} Implements IDbConnection.ConnectionString See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.3. ConnectionTimeout Property Syntax: Visual Basic NotOverridable Public ReadOnly Property ConnectionTimeout As Integer __ Implements IDbConnection.ConnectionTimeout Syntax: C# public int ConnectionTimeout {get;} Implements IDbConnection.ConnectionTimeout See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.4. Database Property Syntax: Visual Basic NotOverridable Public ReadOnly Property Database As String __ Implements IDbConnection.Database Syntax: C# public string Database {get;} Implements IDbConnection.Database See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.5. DataSource Property Gets the name of the MySQL server to which to connect. Syntax: Visual Basic Public ReadOnly Property DataSource As String Syntax: C# public string DataSource {get;} See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.6. ServerThread Property Returns the ID of the server thread this connection is executing on Syntax: Visual Basic Public ReadOnly Property ServerThread As Integer Syntax: C# public int ServerThread {get;} See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.8. State Property Syntax: Visual Basic NotOverridable Public ReadOnly Property State As ConnectionState __ Implements IDbConnection.State Syntax: C# public System.Data.ConnectionState State {get;} Implements IDbConnection.State See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.9. UseCompression Property Indicates if this connection should use compression when communicating with the server. Syntax: Visual Basic Public ReadOnly Property UseCompression As Boolean Syntax: C# public bool UseCompression {get;} See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10. BeginTransaction Method Overload List See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1. MySqlConnection.BeginTransaction Method Syntax: Visual Basic Overloads Public Function BeginTransaction() As MySqlTransaction Syntax: C# public MySqlTransaction BeginTransaction(); See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace, MySqlConnection.BeginTransaction Overload List 22.2.7.1.4.1.1.3.1.1.10.1.1. MySqlTransaction Class For a list of all members of this type, see MySqlTransaction Members . Syntax: Visual Basic NotInheritable Public Class MySqlTransaction_ Implements IDbTransaction, IDisposable Syntax: C# public sealed class MySqlTransaction : IDbTransaction, IDisposable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlTransaction Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1.1.1. MySqlTransaction Members MySqlTransaction overview Public Instance Properties Public Instance Methods See Also MySqlTransaction Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1.1.1.1. Connection Property Gets the MySqlConnection object associated with the transaction, or a null reference (Nothing in Visual Basic) if the transaction is no longer valid. Syntax: Visual Basic Public ReadOnly Property Connection As MySqlConnection Syntax: C# public MySqlConnection Connection {get;} Property Value The MySqlConnection object associated with this transaction. Remarks 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 BeginTransaction. See Also MySqlTransaction Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1.1.1.2. IsolationLevel Property Specifies the IsolationLevel for this transaction. Syntax: Visual Basic NotOverridable Public ReadOnly Property IsolationLevel As IsolationLevel __ Implements IDbTransaction.IsolationLevel Syntax: C# public System.Data.IsolationLevel IsolationLevel {get;} Property Value The IsolationLevel for this transaction. The default is ReadCommitted. Implements IDbTransaction.IsolationLevel Remarks Parallel transactions are not supported. Therefore, the IsolationLevel applies to the entire transaction. See Also MySqlTransaction Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1.1.1.3. MySqlTransaction.Commit Method Syntax: Visual Basic NotOverridable Public Sub Commit() __ Implements IDbTransaction.Commit Syntax: C# public void Commit(); Implements IDbTransaction.Commit See Also MySqlTransaction Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.10.1.1.1.4. MySqlTransaction.Rollback Method Syntax: Visual Basic NotOverridable Public Sub Rollback() __ Implements IDbTransaction.Rollback Syntax: C# public void Rollback(); Implements IDbTransaction.Rollback See Also MySqlTransaction Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.11. MySqlConnection.ChangeDatabase Method Syntax: Visual Basic NotOverridable Public Sub ChangeDatabase( _ ByVal databaseName As String _) __ Implements IDbConnection.ChangeDatabase Syntax: C# public void ChangeDatabase(stringdatabaseName); Implements IDbConnection.ChangeDatabase See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.12. MySqlConnection.Close Method Syntax: Visual Basic NotOverridable Public Sub Close() __ Implements IDbConnection.Close Syntax: C# public void Close(); Implements IDbConnection.Close See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.14. MySqlConnection.Open Method Syntax: Visual Basic NotOverridable Public Sub Open() __ Implements IDbConnection.Open Syntax: C# public void Open(); Implements IDbConnection.Open See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.16. MySqlConnection.InfoMessage Event Syntax: Visual Basic Public Event InfoMessage As MySqlInfoMessageEventHandler Syntax: C# public event MySqlInfoMessageEventHandler InfoMessage; See Also MySqlConnection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.16.1. MySqlInfoMessageEventHandler Delegate Represents the method that will handle the InfoMessage event of a MySqlConnection. Syntax: Visual Basic Public Delegate Sub MySqlInfoMessageEventHandler( _ ByVal sender As Object, _ ByVal args As MySqlInfoMessageEventArgs _) Syntax: C# public delegate void MySqlInfoMessageEventHandler(objectsender,MySqlInfoMessageEventArgsargs); Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.1.3.1.1.16.1.1. MySqlInfoMessageEventArgs Class Provides data for the InfoMessage event. This class cannot be inherited. For a list of all members of this type, see MySqlInfoMessageEventArgs Members . Syntax: Visual Basic Public Class MySqlInfoMessageEventArgs_ Inherits EventArgs Syntax: C# public class MySqlInfoMessageEventArgs : EventArgs Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlInfoMessageEventArgs Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.2. CommandText Property Syntax: Visual Basic NotOverridable Public Property CommandText As String __ Implements IDbCommand.CommandText Syntax: C# public string CommandText {get; set;} Implements IDbCommand.CommandText See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.3. CommandTimeout Property Syntax: Visual Basic NotOverridable Public Property CommandTimeout As Integer __ Implements IDbCommand.CommandTimeout Syntax: C# public int CommandTimeout {get; set;} Implements IDbCommand.CommandTimeout See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.4. CommandType Property Syntax: Visual Basic NotOverridable Public Property CommandType As CommandType __ Implements IDbCommand.CommandType Syntax: C# public System.Data.CommandType CommandType {get; set;} Implements IDbCommand.CommandType See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7. Parameters Property Syntax: Visual Basic Public ReadOnly Property Parameters As MySqlParameterCollection Syntax: C# public MySqlParameterCollection Parameters {get;} See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1. MySqlParameterCollection Class Represents a collection of parameters relevant to a MySqlCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited. For a list of all members of this type, see MySqlParameterCollection Members . Syntax: Visual Basic NotInheritable Public Class MySqlParameterCollection_ Inherits MarshalByRefObject_ Implements IDataParameterCollection, IList, ICollection, IEnumerable Syntax: C# public sealed class MySqlParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlParameterCollection Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1. MySqlParameterCollection Members MySqlParameterCollection overview Public Instance Constructors Public Instance Properties Public Instance Methods See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.2. Count Property Gets the number of MySqlParameter objects in the collection. Syntax: Visual Basic NotOverridable Public ReadOnly Property Count As Integer __ Implements ICollection.Count Syntax: C# public int Count {get;} Implements ICollection.Count See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3. Item Property Gets the MySqlParameter with a specified attribute. In C#, this property is the indexer for the MySqlParameterCollection class. Overload List Gets the MySqlParameter at the specified index. Gets the MySqlParameter with the specified name. See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1. MySqlParameter Class Represents a parameter to a MySqlCommand, and optionally, its mapping to DataSetcolumns. This class cannot be inherited. For a list of all members of this type, see MySqlParameter Members . Syntax: Visual Basic NotInheritable Public Class MySqlParameter_ Inherits MarshalByRefObject_ Implements IDataParameter, IDbDataParameter, ICloneable Syntax: C# public sealed class MySqlParameter : MarshalByRefObject, IDataParameter, IDbDataParameter,ICloneable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlParameter Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1. MySqlParameter Members MySqlParameter overview Public Instance Constructors Public Instance Properties Public Instance Methods See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.1. MySqlParameter Constructor Initializes a new instance of the MySqlParameter class. Overload List Initializes a new instance of the MySqlParameter class. Initializes a new instance of the MySqlParameter class with the parameter name and the data type. Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, and the size. Initializes a new instance of the MySqlParameter class with the parameter name, the type of the parameter, the size of the parameter, a ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a DataRowVersion to use, and the value of the parameter. Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, the size, and the source column name. Initializes a new instance of the MySqlParameter class with the parameter name and a value of the new MySqlParameter. See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.1.3. MySqlParameter Constructor (String, MySqlDbType,Int32) Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, and the size. Syntax: Visual Basic Overloads Public Sub New( _ ByVal parameterName As String, _ ByVal dbType As MySqlDbType, _ ByVal size As Integer _) Syntax: C# public MySqlParameter(stringparameterName,MySqlDbTypedbType,intsize); Parameters parameterName: The name of the parameter to map. dbType: One of the MySqlDbType values. size: The length of the parameter.
See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace, MySqlParameter Constructor Overload List 22.2.7.1.4.1.7.1.1.3.1.1.1.4. MySqlParameter Constructor Initializes a new instance of the MySqlParameter class with the parameter name, the type of the parameter, the size of the parameter, a ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a DataRowVersion to use, and the value of the parameter. Syntax: Visual Basic Overloads Public Sub New( _ ByVal parameterName As String, _ ByVal dbType As MySqlDbType, _ ByVal size As Integer, _ ByVal direction As ParameterDirection, _ ByVal isNullable As Boolean, _ ByVal precision As Byte, _ ByVal scale As Byte, _ ByVal sourceColumn As String, _ ByVal sourceVersion As DataRowVersion, _ ByVal value As Object _) Syntax: C# public MySqlParameter(stringparameterName,MySqlDbTypedbType,intsize,ParameterDirectiondirection,boolisNullable,byteprecision,bytescale,stringsourceColumn,DataRowVersionsourceVersion,objectvalue); Parameters parameterName: The name of the parameter to map. dbType: One of the MySqlDbType values. size: The length of the parameter. direction: One of the ParameterDirectionvalues. isNullable: true if the value of the field can be null, otherwise false. precision: The total number of digits to the left and right of the decimal point to which Value is resolved. scale: The total number of decimal places to which Value is resolved. sourceColumn: The name of the source column. sourceVersion: One of the DataRowVersionvalues. value: An Object that is the value of the MySqlParameter.
Exceptions See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace, MySqlParameter Constructor Overload List 22.2.7.1.4.1.7.1.1.3.1.1.1.4.1. Value Property Gets or sets the value of the parameter. Syntax: Visual Basic NotOverridable Public Property Value As Object __ Implements IDataParameter.Value Syntax: C# public object Value {get; set;} Implements IDataParameter.Value See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.1.5. MySqlParameter Constructor Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, the size, and the source column name. Syntax: Visual Basic Overloads Public Sub New( _ ByVal parameterName As String, _ ByVal dbType As MySqlDbType, _ ByVal size As Integer, _ ByVal sourceColumn As String _) Syntax: C# public MySqlParameter(stringparameterName,MySqlDbTypedbType,intsize,stringsourceColumn); Parameters parameterName: The name of the parameter to map. dbType: One of the MySqlDbType values. size: The length of the parameter. sourceColumn: The name of the source column.
See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace, MySqlParameter Constructor Overload List 22.2.7.1.4.1.7.1.1.3.1.1.2. DbType Property Gets or sets the DbType of the parameter. Syntax: Visual Basic NotOverridable Public Property DbType As DbType __ Implements IDataParameter.DbType Syntax: C# public System.Data.DbType DbType {get; set;} Implements IDataParameter.DbType See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.3. Direction Property 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. Syntax: Visual Basic NotOverridable Public Property Direction As ParameterDirection __ Implements IDataParameter.Direction Syntax: C# public System.Data.ParameterDirection Direction {get; set;} Implements IDataParameter.Direction See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.4. IsNullable Property Gets or sets a value indicating whether the parameter accepts null values. Syntax: Visual Basic NotOverridable Public Property IsNullable As Boolean __ Implements IDataParameter.IsNullable Syntax: C# public bool IsNullable {get; set;} Implements IDataParameter.IsNullable See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.6. MySqlDbType Property Gets or sets the MySqlDbType of the parameter. Syntax: Visual Basic Public Property MySqlDbType As MySqlDbType Syntax: C# public MySqlDbType MySqlDbType {get; set;} See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.7. ParameterName Property Gets or sets the name of the MySqlParameter. Syntax: Visual Basic NotOverridable Public Property ParameterName As String __ Implements IDataParameter.ParameterName Syntax: C# public string ParameterName {get; set;} Implements IDataParameter.ParameterName See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.8. Precision Property Gets or sets the maximum number of digits used to represent the Value property. Syntax: Visual Basic NotOverridable Public Property Precision As Byte __ Implements IDbDataParameter.Precision Syntax: C# public byte Precision {get; set;} Implements IDbDataParameter.Precision See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.9. Scale Property Gets or sets the number of decimal places to which Value is resolved. Syntax: Visual Basic NotOverridable Public Property Scale As Byte __ Implements IDbDataParameter.Scale Syntax: C# public byte Scale {get; set;} Implements IDbDataParameter.Scale See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.10. Size Property Gets or sets the maximum size, in bytes, of the data within the column. Syntax: Visual Basic NotOverridable Public Property Size As Integer __ Implements IDbDataParameter.Size Syntax: C# public int Size {get; set;} Implements IDbDataParameter.Size See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.11. SourceColumn Property Gets or sets the name of the source column that is mapped to the DataSetand used for loading or returning the Value. Syntax: Visual Basic NotOverridable Public Property SourceColumn As String __ Implements IDataParameter.SourceColumn Syntax: C# public string SourceColumn {get; set;} Implements IDataParameter.SourceColumn See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.3.1.1.12. SourceVersion Property Gets or sets the DataRowVersion to use when loading Value. Syntax: Visual Basic NotOverridable Public Property SourceVersion As DataRowVersion __ Implements IDataParameter.SourceVersion Syntax: C# public System.Data.DataRowVersion SourceVersion {get; set;} Implements IDataParameter.SourceVersion See Also MySqlParameter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.4. Add Method Adds the specified MySqlParameter object to the MySqlParameterCollection. Overload List Adds the specified MySqlParameter object to the MySqlParameterCollection. Adds the specified MySqlParameter object to the MySqlParameterCollection. Adds a MySqlParameter to the MySqlParameterCollection given the parameter name and the data type. Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, and the column length. Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, the column length, and the source column name. Adds a MySqlParameter to the MySqlParameterCollection given the specified parameter name and value. See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.4.5. MySqlParameterCollection.Add Method Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, the column length, and the source column name. Syntax: Visual Basic Overloads Public Function Add( _ ByVal parameterName As String, _ ByVal dbType As MySqlDbType, _ ByVal size As Integer, _ ByVal sourceColumn As String _) As MySqlParameter Syntax: C# public MySqlParameter Add(stringparameterName,MySqlDbTypedbType,intsize,stringsourceColumn); Parameters parameterName: The name of the parameter. dbType: One of the MySqlDbType values. size: The length of the column. sourceColumn: The name of the source column.
Return Value The newly added MySqlParameter object. See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace, MySqlParameterCollection.Add Overload List 22.2.7.1.4.1.7.1.1.7. MySqlParameterCollection.CopyTo Method Copies MySqlParameter objects from the MySqlParameterCollection to the specified array. Syntax: Visual Basic NotOverridable Public Sub CopyTo( _ ByVal array As Array, _ ByVal index As Integer _) __ Implements ICollection.CopyTo Syntax: C# public void CopyTo(Arrayarray,intindex); Parameters Implements ICollection.CopyTo See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.9. MySqlParameterCollection.Insert Method Inserts a MySqlParameter into the collection at the specified index. Syntax: Visual Basic NotOverridable Public Sub Insert( _ ByVal index As Integer, _ ByVal value As Object _) __ Implements IList.Insert Syntax: C# public void Insert(intindex,objectvalue); Parameters Implements IList.Insert See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.7.1.1.10. MySqlParameterCollection.Remove Method Removes the specified MySqlParameter from the collection. Syntax: Visual Basic NotOverridable Public Sub Remove( _ ByVal value As Object _) __ Implements IList.Remove Syntax: C# public void Remove(objectvalue); Parameters Implements IList.Remove See Also MySqlParameterCollection Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.9. UpdatedRowSource Property Syntax: Visual Basic NotOverridable Public Property UpdatedRowSource As UpdateRowSource __ Implements IDbCommand.UpdatedRowSource Syntax: C# public System.Data.UpdateRowSource UpdatedRowSource {get; set;} Implements IDbCommand.UpdatedRowSource See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.10. MySqlCommand.Cancel Method Attempts to cancel the execution of a MySqlCommand. This operation is not supported. Syntax: Visual Basic NotOverridable Public Sub Cancel() __ Implements IDbCommand.Cancel Syntax: C# public void Cancel(); Implements IDbCommand.Cancel Remarks Cancelling an executing command is currently not supported on any version of MySQL. Exceptions See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.11. MySqlCommand.CreateParameter Method Creates a new instance of a MySqlParameter object. Syntax: Visual Basic Public Function CreateParameter() As MySqlParameter Syntax: C# public MySqlParameter CreateParameter(); Return Value A MySqlParameter object. Remarks This method is a strongly-typed version of CreateParameter. See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.12. MySqlCommand.ExecuteNonQuery Method Syntax: Visual Basic NotOverridable Public Function ExecuteNonQuery() As Integer __ Implements IDbCommand.ExecuteNonQuery Syntax: C# public int ExecuteNonQuery(); Implements IDbCommand.ExecuteNonQuery See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13. ExecuteReader Method Overload List See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1. MySqlCommand.ExecuteReader Method Syntax: Visual Basic Overloads Public Function ExecuteReader() As MySqlDataReader Syntax: C# public MySqlDataReader ExecuteReader(); See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace, MySqlCommand.ExecuteReader Overload List 22.2.7.1.4.1.13.1.1. MySqlDataReader Class Provides a means of reading a forward-only stream of rows from a MySQL database. This class cannot be inherited. For a list of all members of this type, see MySqlDataReader Members . Syntax: Visual Basic NotInheritable Public Class MySqlDataReader_ Inherits MarshalByRefObject_ Implements IEnumerable, IDataReader, IDisposable, IDataRecord Syntax: C# public sealed class MySqlDataReader : MarshalByRefObject, IEnumerable,IDataReader, IDisposable, IDataRecord Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlDataReader Members, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1. MySqlDataReader Members MySqlDataReader overview Public Instance Properties Public Instance Methods See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.1. Depth Property Gets a value indicating the depth of nesting for the current row. This method is not supported currently and always returns 0. Syntax: Visual Basic NotOverridable Public ReadOnly Property Depth As Integer __ Implements IDataReader.Depth Syntax: C# public int Depth {get;} Implements IDataReader.Depth See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.2. FieldCount Property Gets the number of columns in the current row. Syntax: Visual Basic NotOverridable Public ReadOnly Property FieldCount As Integer __ Implements IDataRecord.FieldCount Syntax: C# public int FieldCount {get;} Implements IDataRecord.FieldCount See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.3. HasRows Property Gets a value indicating whether the MySqlDataReader contains one or more rows. Syntax: Visual Basic Public ReadOnly Property HasRows As Boolean Syntax: C# public bool HasRows {get;} See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.4. IsClosed Property Gets a value indicating whether the data reader is closed. Syntax: Visual Basic NotOverridable Public ReadOnly Property IsClosed As Boolean __ Implements IDataReader.IsClosed Syntax: C# public bool IsClosed {get;} Implements IDataReader.IsClosed See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.5. Item Property Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class. Overload List 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. In C#, this property is the indexer for the MySqlDataReader class. See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.5.1. Item Property (Int32) Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class. Syntax: Visual Basic NotOverridable Overloads Public Default ReadOnly Property Item( _ ByVal i As Integer _) __ Implements IDataRecord.Item As Object __ Implements IDataRecord.Item Syntax: C# public object this[inti] {get;} Implements IDataRecord.Item See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace, MySqlDataReader.Item Overload List 22.2.7.1.4.1.13.1.1.1.5.2. Item Property (String) Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class. Syntax: Visual Basic NotOverridable Overloads Public Default ReadOnly Property Item( _ ByVal name As String _) __ Implements IDataRecord.Item As Object __ Implements IDataRecord.Item Syntax: C# public object this[stringname] {get;} Implements IDataRecord.Item See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace, MySqlDataReader.Item Overload List 22.2.7.1.4.1.13.1.1.1.6. RecordsAffected Property Gets the number of rows changed, inserted, or deleted by execution of the SQL statement. Syntax: Visual Basic NotOverridable Public ReadOnly Property RecordsAffected As Integer __ Implements IDataReader.RecordsAffected Syntax: C# public int RecordsAffected {get;} Implements IDataReader.RecordsAffected See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.7. MySqlDataReader.Close Method Closes the MySqlDataReader object. Syntax: Visual Basic NotOverridable Public Sub Close() __ Implements IDataReader.Close Syntax: C# public void Close(); Implements IDataReader.Close See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.8. MySqlDataReader.GetBoolean Method Gets the value of the specified column as a Boolean. Syntax: Visual Basic NotOverridable Public Function GetBoolean( _ ByVal i As Integer _) As Boolean __ Implements IDataRecord.GetBoolean Syntax: C# public bool GetBoolean(inti); Parameters Return Value Implements IDataRecord.GetBoolean See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.9. MySqlDataReader.GetByte Method Gets the value of the specified column as a byte. Syntax: Visual Basic NotOverridable Public Function GetByte( _ ByVal i As Integer _) As Byte __ Implements IDataRecord.GetByte Syntax: C# public byte GetByte(inti); Parameters Return Value Implements IDataRecord.GetByte See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.10. MySqlDataReader.GetBytes Method Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset. Syntax: Visual Basic NotOverridable Public Function GetBytes( _ ByVal i As Integer, _ ByVal dataIndex As Long, _ ByVal buffer As Byte(), _ ByVal bufferIndex As Integer, _ ByVal length As Integer _) As Long __ Implements IDataRecord.GetBytes Syntax: C# public long GetBytes(inti,longdataIndex,byte[]buffer,intbufferIndex,intlength); Parameters i: The zero-based column ordinal. dataIndex: The index within the field from which to begin the read operation. buffer: The buffer into which to read the stream of bytes. bufferIndex: The index for buffer to begin the read operation. length: The maximum length to copy into the buffer.
Return Value The actual number of bytes read. Implements IDataRecord.GetBytes See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.11. MySqlDataReader.GetChar Method Gets the value of the specified column as a single character. Syntax: Visual Basic NotOverridable Public Function GetChar( _ ByVal i As Integer _) As Char __ Implements IDataRecord.GetChar Syntax: C# public char GetChar(inti); Parameters Return Value Implements IDataRecord.GetChar See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.12. MySqlDataReader.GetChars Method Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset. Syntax: Visual Basic NotOverridable Public Function GetChars( _ ByVal i As Integer, _ ByVal fieldOffset As Long, _ ByVal buffer As Char(), _ ByVal bufferoffset As Integer, _ ByVal length As Integer _) As Long __ Implements IDataRecord.GetChars Syntax: C# public long GetChars(inti,longfieldOffset,char[]buffer,intbufferoffset,intlength); Parameters i: fieldOffset: buffer: bufferoffset: length:
Return Value Implements IDataRecord.GetChars See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.13. MySqlDataReader.GetDataTypeName Method Gets the name of the source data type. Syntax: Visual Basic NotOverridable Public Function GetDataTypeName( _ ByVal i As Integer _) As String __ Implements IDataRecord.GetDataTypeName Syntax: C# public string GetDataTypeName(inti); Parameters Return Value Implements IDataRecord.GetDataTypeName See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.14. MySqlDataReader.GetDateTime Method Syntax: Visual Basic NotOverridable Public Function GetDateTime( _ ByVal index As Integer _) As Date __ Implements IDataRecord.GetDateTime Syntax: C# public DateTime GetDateTime(intindex); Implements IDataRecord.GetDateTime See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.15. MySqlDataReader.GetDecimal Method Syntax: Visual Basic NotOverridable Public Function GetDecimal( _ ByVal index As Integer _) As Decimal __ Implements IDataRecord.GetDecimal Syntax: C# public decimal GetDecimal(intindex); Implements IDataRecord.GetDecimal See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.16. MySqlDataReader.GetDouble Method Syntax: Visual Basic NotOverridable Public Function GetDouble( _ ByVal index As Integer _) As Double __ Implements IDataRecord.GetDouble Syntax: C# public double GetDouble(intindex); Implements IDataRecord.GetDouble See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.17. MySqlDataReader.GetFieldType Method Gets the Type that is the data type of the object. Syntax: Visual Basic NotOverridable Public Function GetFieldType( _ ByVal i As Integer _) As Type __ Implements IDataRecord.GetFieldType Syntax: C# public Type GetFieldType(inti); Parameters Return Value Implements IDataRecord.GetFieldType See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.18. MySqlDataReader.GetFloat Method Syntax: Visual Basic NotOverridable Public Function GetFloat( _ ByVal index As Integer _) As Single __ Implements IDataRecord.GetFloat Syntax: C# public float GetFloat(intindex); Implements IDataRecord.GetFloat See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.19. MySqlDataReader.GetGuid Method Syntax: Visual Basic NotOverridable Public Function GetGuid( _ ByVal index As Integer _) As Guid __ Implements IDataRecord.GetGuid Syntax: C# public Guid GetGuid(intindex); Implements IDataRecord.GetGuid See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.20. MySqlDataReader.GetInt16 Method Syntax: Visual Basic NotOverridable Public Function GetInt16( _ ByVal index As Integer _) As Short __ Implements IDataRecord.GetInt16 Syntax: C# public short GetInt16(intindex); Implements IDataRecord.GetInt16 See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.21. MySqlDataReader.GetInt32 Method Syntax: Visual Basic NotOverridable Public Function GetInt32( _ ByVal index As Integer _) As Integer __ Implements IDataRecord.GetInt32 Syntax: C# public int GetInt32(intindex); Implements IDataRecord.GetInt32 See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.22. MySqlDataReader.GetInt64 Method Syntax: Visual Basic NotOverridable Public Function GetInt64( _ ByVal index As Integer _) As Long __ Implements IDataRecord.GetInt64 Syntax: C# public long GetInt64(intindex); Implements IDataRecord.GetInt64 See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.23. MySqlDataReader.GetMySqlDateTime Method Syntax: Visual Basic Public Function GetMySqlDateTime( _ ByVal index As Integer _) As MySqlDateTime Syntax: C# public MySqlDateTime GetMySqlDateTime(intindex); See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.24. MySqlDataReader.GetName Method Gets the name of the specified column. Syntax: Visual Basic NotOverridable Public Function GetName( _ ByVal i As Integer _) As String __ Implements IDataRecord.GetName Syntax: C# public string GetName(inti); Parameters Return Value Implements IDataRecord.GetName See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.25. MySqlDataReader.GetOrdinal Method Gets the column ordinal, given the name of the column. Syntax: Visual Basic NotOverridable Public Function GetOrdinal( _ ByVal name As String _) As Integer __ Implements IDataRecord.GetOrdinal Syntax: C# public int GetOrdinal(stringname); Parameters Return Value Implements IDataRecord.GetOrdinal See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.26. MySqlDataReader.GetSchemaTable Method Returns a DataTable that describes the column metadata of the MySqlDataReader. Syntax: Visual Basic NotOverridable Public Function GetSchemaTable() As DataTable __ Implements IDataReader.GetSchemaTable Syntax: C# public DataTable GetSchemaTable(); Return Value Implements IDataReader.GetSchemaTable See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.27. MySqlDataReader.GetString Method Syntax: Visual Basic NotOverridable Public Function GetString( _ ByVal index As Integer _) As String __ Implements IDataRecord.GetString Syntax: C# public string GetString(intindex); Implements IDataRecord.GetString See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.28. MySqlDataReader.GetTimeSpan Method Syntax: Visual Basic Public Function GetTimeSpan( _ ByVal index As Integer _) As TimeSpan Syntax: C# public TimeSpan GetTimeSpan(intindex); See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.32. MySqlDataReader.GetValue Method Gets the value of the specified column in its native format. Syntax: Visual Basic NotOverridable Public Function GetValue( _ ByVal i As Integer _) As Object __ Implements IDataRecord.GetValue Syntax: C# public object GetValue(inti); Parameters Return Value Implements IDataRecord.GetValue See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.33. MySqlDataReader.GetValues Method Gets all attribute columns in the collection for the current row. Syntax: Visual Basic NotOverridable Public Function GetValues( _ ByVal values As Object() _) As Integer __ Implements IDataRecord.GetValues Syntax: C# public int GetValues(object[]values); Parameters Return Value Implements IDataRecord.GetValues See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.34. MySqlDataReader.IsDBNull Method Gets a value indicating whether the column contains non-existent or missing values. Syntax: Visual Basic NotOverridable Public Function IsDBNull( _ ByVal i As Integer _) As Boolean __ Implements IDataRecord.IsDBNull Syntax: C# public bool IsDBNull(inti); Parameters Return Value Implements IDataRecord.IsDBNull See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.35. MySqlDataReader.NextResult Method Advances the data reader to the next result, when reading the results of batch SQL statements. Syntax: Visual Basic NotOverridable Public Function NextResult() As Boolean __ Implements IDataReader.NextResult Syntax: C# public bool NextResult(); Return Value Implements IDataReader.NextResult See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.13.1.1.1.36. MySqlDataReader.Read Method Advances the MySqlDataReader to the next record. Syntax: Visual Basic NotOverridable Public Function Read() As Boolean __ Implements IDataReader.Read Syntax: C# public bool Read(); Return Value Implements IDataReader.Read See Also MySqlDataReader Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.14. MySqlCommand.ExecuteScalar Method Syntax: Visual Basic NotOverridable Public Function ExecuteScalar() As Object __ Implements IDbCommand.ExecuteScalar Syntax: C# public object ExecuteScalar(); Implements IDbCommand.ExecuteScalar See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.4.1.15. MySqlCommand.Prepare Method Syntax: Visual Basic NotOverridable Public Sub Prepare() __ Implements IDbCommand.Prepare Syntax: C# public void Prepare(); Implements IDbCommand.Prepare See Also MySqlCommand Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5. MySqlCommandBuilder Class For a list of all members of this type, see MySqlCommandBuilder Members . Syntax: Visual Basic NotInheritable Public Class MySqlCommandBuilder_ Inherits Component Syntax: C# public sealed class MySqlCommandBuilder : Component Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlCommandBuilder Members, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1. MySqlCommandBuilder Members MySqlCommandBuilder overview Public Static (Shared) Methods Public Instance Constructors Public Instance Properties Public Instance Methods Public Instance Events See Also MySqlCommandBuilder Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.1. DeriveParameters Method 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. Overload List 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. See Also MySqlCommandBuilder Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.1.1. MySqlCommandBuilder.DeriveParameters Method 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. Syntax: Visual Basic Overloads Public Shared Sub DeriveParameters( _ ByVal command As MySqlCommand _) Syntax: C# public static void DeriveParameters(MySqlCommandcommand); Parameters Exceptions See Also MySqlCommandBuilder Class, MySql.Data.MySqlClient Namespace, MySqlCommandBuilder.DeriveParameters Overload List 22.2.7.1.5.1.2. MySqlCommandBuilder Constructor Initializes a new instance of the MySqlCommandBuilder class. Overload List Initializes a new instance of the MySqlCommandBuilder class. See Also MySqlCommandBuilder Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2. MySqlCommandBuilder Constructor Syntax: Visual Basic Overloads Public Sub New( _ ByVal adapter As MySqlDataAdapter _) Syntax: C# public MySqlCommandBuilder(MySqlDataAdapteradapter); See Also MySqlCommandBuilder Class, MySql.Data.MySqlClient Namespace, MySqlCommandBuilder Constructor Overload List 22.2.7.1.5.1.2.2.1. MySqlDataAdapter Class For a list of all members of this type, see MySqlDataAdapter Members . Syntax: Visual Basic NotInheritable Public Class MySqlDataAdapter_ Inherits DbDataAdapter Syntax: C# public sealed class MySqlDataAdapter : DbDataAdapter Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlDataAdapter Members, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1. MySqlDataAdapter Members MySqlDataAdapter overview Public Instance Constructors Public Instance Properties Public Instance Methods Public Instance Events Protected Internal Instance Properties See Also MySqlDataAdapter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6. MySqlDataAdapter.RowUpdated Event Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires. Syntax: Visual Basic Public Event RowUpdated As MySqlRowUpdatedEventHandler Syntax: C# public event MySqlRowUpdatedEventHandler RowUpdated; Event Data The event handler receives an argument of type MySqlRowUpdatedEventArgs containing data related to this event. The following MySqlRowUpdatedEventArgsproperties provide information specific to this event. See Also MySqlDataAdapter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6.1. MySqlRowUpdatedEventHandler Delegate Represents the method that will handle the RowUpdatedevent of a MySqlDataAdapter. Syntax: Visual Basic Public Delegate Sub MySqlRowUpdatedEventHandler( _ ByVal sender As Object, _ ByVal e As MySqlRowUpdatedEventArgs _) Syntax: C# public delegate void MySqlRowUpdatedEventHandler(objectsender,MySqlRowUpdatedEventArgs); Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6.1.1. MySqlRowUpdatedEventArgs Class Provides data for the RowUpdated event. This class cannot be inherited. For a list of all members of this type, see MySqlRowUpdatedEventArgs Members . Syntax: Visual Basic NotInheritable Public Class MySqlRowUpdatedEventArgs_ Inherits RowUpdatedEventArgs Syntax: C# public sealed class MySqlRowUpdatedEventArgs : RowUpdatedEventArgs Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlRowUpdatedEventArgs Members, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6.1.1.1. MySqlRowUpdatedEventArgs Members MySqlRowUpdatedEventArgs overview Public Instance Constructors Public Instance Properties Public Instance Methods See Also MySqlRowUpdatedEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6.1.1.1.1. MySqlRowUpdatedEventArgs Constructor Initializes a new instance of the MySqlRowUpdatedEventArgs class. Syntax: Visual Basic Public Sub New( _ ByVal row As DataRow, _ ByVal command As IDbCommand, _ ByVal statementType As StatementType, _ ByVal tableMapping As DataTableMapping _) Syntax: C# public MySqlRowUpdatedEventArgs(DataRowrow,IDbCommandcommand,StatementTypestatementType,DataTableMappingtableMapping); Parameters row: The DataRowsent through an Update. command: The IDbCommand executed when Update is called. statementType: One of the StatementTypevalues that specifies the type of query executed. tableMapping: The DataTableMapping sent through an Update.
See Also MySqlRowUpdatedEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.6.1.1.1.2. Command Property Gets or sets the MySqlCommand executed when Update is called. Syntax: Visual Basic Overloads Public ReadOnly Property Command As MySqlCommand Syntax: C# new public MySqlCommand Command {get;} See Also MySqlRowUpdatedEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7. MySqlDataAdapter.RowUpdating Event Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires. Syntax: Visual Basic Public Event RowUpdating As MySqlRowUpdatingEventHandler Syntax: C# public event MySqlRowUpdatingEventHandler RowUpdating; Event Data The event handler receives an argument of type MySqlRowUpdatingEventArgs containing data related to this event. The following MySqlRowUpdatingEventArgsproperties provide information specific to this event. See Also MySqlDataAdapter Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7.1. MySqlRowUpdatingEventHandler Delegate Represents the method that will handle the RowUpdatingevent of a MySqlDataAdapter. Syntax: Visual Basic Public Delegate Sub MySqlRowUpdatingEventHandler( _ ByVal sender As Object, _ ByVal e As MySqlRowUpdatingEventArgs _) Syntax: C# public delegate void MySqlRowUpdatingEventHandler(objectsender,MySqlRowUpdatingEventArgs); Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7.1.1. MySqlRowUpdatingEventArgs Class Provides data for the RowUpdating event. This class cannot be inherited. For a list of all members of this type, see MySqlRowUpdatingEventArgs Members . Syntax: Visual Basic NotInheritable Public Class MySqlRowUpdatingEventArgs_ Inherits RowUpdatingEventArgs Syntax: C# public sealed class MySqlRowUpdatingEventArgs : RowUpdatingEventArgs Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlRowUpdatingEventArgs Members, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7.1.1.1. MySqlRowUpdatingEventArgs Members MySqlRowUpdatingEventArgs overview Public Instance Constructors Public Instance Properties Public Instance Methods See Also MySqlRowUpdatingEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7.1.1.1.1. MySqlRowUpdatingEventArgs Constructor Initializes a new instance of the MySqlRowUpdatingEventArgs class. Syntax: Visual Basic Public Sub New( _ ByVal row As DataRow, _ ByVal command As IDbCommand, _ ByVal statementType As StatementType, _ ByVal tableMapping As DataTableMapping _) Syntax: C# public MySqlRowUpdatingEventArgs(DataRowrow,IDbCommandcommand,StatementTypestatementType,DataTableMappingtableMapping); Parameters row: The DataRowto Update. command: The IDbCommandto execute during Update. statementType: One of the StatementTypevalues that specifies the type of query executed. tableMapping: The DataTableMappingsent through an Update.
See Also MySqlRowUpdatingEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.5.1.2.2.1.1.7.1.1.1.2. Command Property Gets or sets the MySqlCommand to execute when performing the Update. Syntax: Visual Basic Overloads Public Property Command As MySqlCommand Syntax: C# new public MySqlCommand Command {get; set;} See Also MySqlRowUpdatingEventArgs Class, MySql.Data.MySqlClient Namespace 22.2.7.1.6. MySqlException Class The exception that is thrown when MySQL returns an error. This class cannot be inherited. For a list of all members of this type, see MySqlException Members . Syntax: Visual Basic NotInheritable Public Class MySqlException_ Inherits SystemException Syntax: C# public sealed class MySqlException : SystemException Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlException Members, MySql.Data.MySqlClient Namespace 22.2.7.1.7. MySqlHelper Class Helper class that makes it easier to work with the provider. For a list of all members of this type, see MySqlHelper Members . Syntax: Visual Basic NotInheritable Public Class MySqlHelper Syntax: C# public sealed class MySqlHelper Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.MySqlClient Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlHelper Members, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1. MySqlHelper Members MySqlHelper overview Public Static (Shared) Methods Public Instance Methods See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.1. MySqlHelper.ExecuteDataRow Method Executes a single SQL statement and returns the first row of the resultset. A new MySqlConnection object is created, opened, and closed during this method. Syntax: Visual Basic Public Shared Function ExecuteDataRow( _ ByVal connectionString As String, _ ByVal commandText As String, _ ParamArray parms As MySqlParameter() _) As DataRow Syntax: C# public static DataRow ExecuteDataRow(stringconnectionString,stringcommandText, params MySqlParameter[]parms); Parameters connectionString: Settings to be used for the connection commandText: Command to execute parms: Parameters to use for the command
Return Value DataRow containing the first row of the resultset See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.2. ExecuteDataset Method Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method. Overload List Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method. Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method. Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method. Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.2.1. MySqlHelper.ExecuteDataset Method Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method. Syntax: Visual Basic Overloads Public Shared Function ExecuteDataset( _ ByVal connection As MySqlConnection, _ ByVal commandText As String _) As DataSet Syntax: C# public static DataSet ExecuteDataset(MySqlConnectionconnection,stringcommandText); Parameters Return Value DataSetcontaining the resultset See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteDataset Overload List 22.2.7.1.7.1.2.2. MySqlHelper.ExecuteDataset Method Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method. Syntax: Visual Basic Overloads Public Shared Function ExecuteDataset( _ ByVal connection As MySqlConnection, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As DataSet Syntax: C# public static DataSet ExecuteDataset(MySqlConnectionconnection,stringcommandText, params MySqlParameter[]commandParameters); Parameters connection: MySqlConnection object to use commandText: Command to execute commandParameters: Parameters to use for the command
Return Value DataSetcontaining the resultset See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteDataset Overload List 22.2.7.1.7.1.2.3. MySqlHelper.ExecuteDataset Method Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method. Syntax: Visual Basic Overloads Public Shared Function ExecuteDataset( _ ByVal connectionString As String, _ ByVal commandText As String _) As DataSet Syntax: C# public static DataSet ExecuteDataset(stringconnectionString,stringcommandText); Parameters Return Value DataSetcontaining the resultset See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteDataset Overload List 22.2.7.1.7.1.2.4. MySqlHelper.ExecuteDataset Method Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method. Syntax: Visual Basic Overloads Public Shared Function ExecuteDataset( _ ByVal connectionString As String, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As DataSet Syntax: C# public static DataSet ExecuteDataset(stringconnectionString,stringcommandText, params MySqlParameter[]commandParameters); Parameters connectionString: Settings to be used for the connection commandText: Command to execute commandParameters: Parameters to use for the command
Return Value DataSetcontaining the resultset See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteDataset Overload List 22.2.7.1.7.1.3. ExecuteNonQuery Method Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and remains open after the method completes. Overload List Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and remains open after the method completes. Executes a single command against a MySQL database. A new MySqlConnection is created using the ConnectionString given. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.3.1. MySqlHelper.ExecuteNonQuery Method Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and remains open after the method completes. Syntax: Visual Basic Overloads Public Shared Function ExecuteNonQuery( _ ByVal connection As MySqlConnection, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As Integer Syntax: C# public static int ExecuteNonQuery(MySqlConnectionconnection,stringcommandText, params MySqlParameter[]commandParameters); Parameters connection: MySqlConnection object to use commandText: SQL statement to be executed commandParameters: Array of MySqlParameter objects to use with the command.
Return Value See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteNonQuery Overload List 22.2.7.1.7.1.3.2. MySqlHelper.ExecuteNonQuery Method Executes a single command against a MySQL database. A new MySqlConnection is created using the ConnectionString given. Syntax: Visual Basic Overloads Public Shared Function ExecuteNonQuery( _ ByVal connectionString As String, _ ByVal commandText As String, _ ParamArray parms As MySqlParameter() _) As Integer Syntax: C# public static int ExecuteNonQuery(stringconnectionString,stringcommandText, params MySqlParameter[]parms); Parameters Return Value See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteNonQuery Overload List 22.2.7.1.7.1.4. ExecuteReader Method Executes a single command against a MySQL database. Overload List Executes a single command against a MySQL database. Executes a single command against a MySQL database. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.4.1. MySqlHelper.ExecuteReader Method Executes a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteReader( _ ByVal connectionString As String, _ ByVal commandText As String _) As MySqlDataReader Syntax: C# public static MySqlDataReader ExecuteReader(stringconnectionString,stringcommandText); Parameters Return Value MySqlDataReader object ready to read the results of the command See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteReader Overload List 22.2.7.1.7.1.4.2. MySqlHelper.ExecuteReader Method Executes a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteReader( _ ByVal connectionString As String, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As MySqlDataReader Syntax: C# public static MySqlDataReader ExecuteReader(stringconnectionString,stringcommandText, params MySqlParameter[]commandParameters); Parameters connectionString: Settings to use for this command commandText: Command text to use commandParameters: Array of MySqlParameter objects to use with the command
Return Value MySqlDataReader object ready to read the results of the command See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteReader Overload List 22.2.7.1.7.1.5. ExecuteScalar Method Execute a single command against a MySQL database. Overload List Execute a single command against a MySQL database. Execute a single command against a MySQL database. Execute a single command against a MySQL database. Execute a single command against a MySQL database. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.1.7.1.5.1. MySqlHelper.ExecuteScalar Method Execute a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteScalar( _ ByVal connection As MySqlConnection, _ ByVal commandText As String _) As Object Syntax: C# public static object ExecuteScalar(MySqlConnectionconnection,stringcommandText); Parameters Return Value The first column of the first row in the result set, or a null reference if the result set is empty. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteScalar Overload List 22.2.7.1.7.1.5.2. MySqlHelper.ExecuteScalar Method Execute a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteScalar( _ ByVal connection As MySqlConnection, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As Object Syntax: C# public static object ExecuteScalar(MySqlConnectionconnection,stringcommandText, params MySqlParameter[]commandParameters); Parameters connection: MySqlConnection object to use commandText: Command text to use for the command commandParameters: Parameters to use for the command
Return Value The first column of the first row in the result set, or a null reference if the result set is empty. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteScalar Overload List 22.2.7.1.7.1.5.3. MySqlHelper.ExecuteScalar Method Execute a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteScalar( _ ByVal connectionString As String, _ ByVal commandText As String _) As Object Syntax: C# public static object ExecuteScalar(stringconnectionString,stringcommandText); Parameters Return Value The first column of the first row in the result set, or a null reference if the result set is empty. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteScalar Overload List 22.2.7.1.7.1.5.4. MySqlHelper.ExecuteScalar Method Execute a single command against a MySQL database. Syntax: Visual Basic Overloads Public Shared Function ExecuteScalar( _ ByVal connectionString As String, _ ByVal commandText As String, _ ParamArray commandParameters As MySqlParameter() _) As Object Syntax: C# public static object ExecuteScalar(stringconnectionString,stringcommandText, params MySqlParameter[]commandParameters); Parameters connectionString: Settings to use for the command commandText: Command text to use for the command commandParameters: Parameters to use for the command
Return Value The first column of the first row in the result set, or a null reference if the result set is empty. See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace, MySqlHelper.ExecuteScalar Overload List 22.2.7.1.7.1.6. MySqlHelper.UpdateDataSet Method Updates the given table with data from the given DataSet Syntax: Visual Basic Public Shared Sub UpdateDataSet( _ ByVal connectionString As String, _ ByVal commandText As String, _ ByVal ds As DataSet, _ ByVal tablename As String _) Syntax: C# public static void UpdateDataSet(stringconnectionString,stringcommandText,DataSetds,stringtablename); Parameters connectionString: Settings to use for the update commandText: Command text to use for the update ds: DataSetcontaining the new data to use in the update tablename: Tablename in the data set to update
See Also MySqlHelper Class, MySql.Data.MySqlClient Namespace 22.2.7.2. MySql.Data.Types Namespace Namespace hierarchy Classes 22.2.7.2.2. MySqlConversionException Class Summary description for MySqlConversionException. For a list of all members of this type, see MySqlConversionException Members . Syntax: Visual Basic Public Class MySqlConversionException_ Inherits ApplicationException Syntax: C# public class MySqlConversionException : ApplicationException Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.Types Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlConversionException Members, MySql.Data.Types Namespace 22.2.7.2.3. MySqlDateTime Class Summary description for MySqlDateTime. For a list of all members of this type, see MySqlDateTime Members . Syntax: Visual Basic Public Class MySqlDateTime_ Inherits MySqlValue_ Implements IConvertible, IComparable Syntax: C# public class MySqlDateTime : MySqlValue, IConvertible, IComparable Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.Types Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlDateTime Members, MySql.Data.Types Namespace 22.2.7.2.3.1. MySqlDateTime Members MySqlDateTime overview Public Static (Shared) Type Conversions Public Instance Properties Public Instance Methods Protected Instance Fields Protected Instance Methods See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.1. MySqlDateTime Explicit MySqlDateTime toDateTime Conversion Syntax: Visual Basic MySqlDateTime.op_Explicit(val) Syntax: C# public static explicit operator DateTime(MySqlDateTimeval); Parameters Return Value See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4. IsNull Property Syntax: Visual Basic Public Property IsNull As Boolean Syntax: C# public bool IsNull {get; set;} See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1. MySqlValue Class For a list of all members of this type, see MySqlValue Members . Syntax: Visual Basic MustInherit Public Class MySqlValue Syntax: C# public abstract class MySqlValue Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. Requirements Namespace: MySql.Data.Types Assembly: MySql.Data (in MySql.Data.dll) See Also MySqlValue Members, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1. MySqlValue Members MySqlValue overview Protected Static (Shared) Fields Public Instance Constructors Public Instance Properties Public Instance Methods Protected Instance Fields Protected Instance Methods See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.1. MySqlValue.numberFormat Field Syntax: Visual Basic Protected Shared numberFormat As NumberFormatInfo Syntax: C# protected static NumberFormatInfo numberFormat; See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.3. ValueAsObject Property Returns the value of this field as an object Syntax: Visual Basic Public ReadOnly Property ValueAsObject As Object Syntax: C# public object ValueAsObject {get;} See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.4. MySqlValue.ToString Method Returns a string representation of this value Syntax: Visual Basic Overrides Public Function ToString() As String Syntax: C# public override string ToString(); See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.5. MySqlValue.classType Field The system type represented by this value Syntax: Visual Basic Protected classType As Type Syntax: C# protected Type classType; See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.6. MySqlValue.dbType Field The generic dbtype of this value Syntax: Visual Basic Protected dbType As DbType Syntax: C# protected DbType dbType; See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.7. MySqlValue.mySqlDbType Field The specific MySQL db type Syntax: Visual Basic Protected mySqlDbType As MySqlDbType Syntax: C# protected MySqlDbType mySqlDbType; See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.4.1.1.8. MySqlValue.mySqlTypeName Field The MySQL-specific typename of this value Syntax: Visual Basic Protected mySqlTypeName As String Syntax: C# protected string mySqlTypeName; See Also MySqlValue Class, MySql.Data.Types Namespace 22.2.7.2.3.1.5. IsValidDateTime Property Indicates if this object contains a value that can be represented as a DateTime Syntax: Visual Basic Public ReadOnly Property IsValidDateTime As Boolean Syntax: C# public bool IsValidDateTime {get;} See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.6. Millisecond Property Returns the millisecond portion of this datetime Syntax: Visual Basic Public Property Millisecond As Integer Syntax: C# public int Millisecond {get; set;} See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.7. Minute Property Returns the minute portion of this datetime Syntax: Visual Basic Public Property Minute As Integer Syntax: C# public int Minute {get; set;} See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.9. Second Property Returns the second portion of this datetime Syntax: Visual Basic Public Property Second As Integer Syntax: C# public int Second {get; set;} See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.11. MySqlDateTime.GetDateTime Method Returns this value as a DateTime Syntax: Visual Basic Public Function GetDateTime() As Date Syntax: C# public DateTime GetDateTime(); See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.7.2.3.1.12. MySqlDateTime.ToString Method Returns a MySQL-specific string representation of this value Syntax: Visual Basic Overrides Public Function ToString() As String Syntax: C# public override string ToString(); See Also MySqlDateTime Class, MySql.Data.Types Namespace 22.2.8. Connector/Net Support The developers of Connector/Net greatly value the input of our users in the software development process. If you find Connector/Net lacking some feature important to you, or if you discover a bug and need to file a bug report, please use the instructions in Section 1.7, "How to Report Bugs or Problems". 22.2.8.1. Connector/Net Community Support22.2.8.2. How to Report Connector/Net Problems or Bugs If you encounter difficulties or problems with Connector/Net, contact the Connector/Net community, as explained in Section 22.2.8.1, "Connector/Net Community Support". First try to execute the same SQL statements and commands from the mysql client program or from admndemo. This helps you determine whether the error is in Connector/Net or MySQL. If reporting a problem, ideally include the following information with the email: Operating system and version. Connector/Net version. MySQL server version. Copies of error messages or other unexpected output. Simple reproducible sample.
Remember that the more information you can supply to us, the more likely it is that we can fix the problem. If you believe the problem to be a bug, then you must report the bug through http://bugs.mysql.com/. 22.2.9. Connector/Net FAQQuestions Questions and Answers 23.2.9.1: How do I obtain the value of an auto-incremented column? When using CommandBuilder, setting ReturnGeneratedIdentifiers property to true no longer works, as CommandBuilder does not add last_insert_id() by default. CommandBuilder hooks up to the DataAdapter.RowUpdating event handler, which means it will get called for every row. It examines the command object and, if it is the same referenced object, it essentially rebuilds the object, thereby destroying your command text changes. One approach to solving this problem is to clone the command object so you have a different actual reference: dataAdapter.InsertCommand = cb.GetInsertCommand().Clone() This will work, but since the CommandBuilder is still connected to the DataAdapter, the RowUpdating event will still fire and performance will be hit. To stop that, once all your commands have been added you need to disconnect the CommandBuilder from the DataAdapter: cb.DataAdapter = null; The last requirement is to make sure the id that is returned by last_insert_id() has the correct name. For example: SELECT last_insert_id() AS id A complete working example is shown here: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using MySql.Data;using MySql.Data.MySqlClient;namespace GetAutoIncId{ class Program { static void Main(string[] args) { string connStr = "server=localhost;user=root;database=TestDB;port=3306;password=******;"; MySqlConnection conn = new MySqlConnection(connStr); try { Console.WriteLine("Connecting to MySQL..."); conn.Open(); string sql = "SELECT * FROM TestTable"; MySqlDataAdapter da = new MySqlDataAdapter(sql, conn); MySqlCommandBuilder cb = new MySqlCommandBuilder(da); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; // use Cloned object to avoid .NET rebuilding the object, and // thereby throwing away our command text additions. MySqlCommand insertCmd = cb.GetInsertCommand().Clone(); insertCmd.CommandText = insertCmd.CommandText + ";SELECT last_insert_id() AS id"; insertCmd.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; da.InsertCommand = insertCmd; cb.DataAdapter = null; // Unhook RowUpdating event handler DataTable dt = new DataTable(); da.Fill(dt); DataRow row = dt.NewRow(); row["name"] = "Joe Smith"; dt.Rows.Add(row); da.Update(dt); System.Console.WriteLine("ID after update: " + row["id"]); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } conn.Close(); Console.WriteLine("Done."); } }} Copyright © 1997, 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices |
| |