C# Class MySql.Data.MySqlClient.MySqlHelper

Show file Open project: elevate/mysqlconnector-.net Class Usage Examples

Public Methods

Method Description
DoubleQuoteString ( string value ) : string
EscapeString ( string value ) : string

Escapes the string.

ExecuteDataRow ( string connectionString, string commandText ) : DataRow

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.

ExecuteDataset ( MySqlConnection connection, string commandText ) : DataSet

Executes a single SQL command and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method.

ExecuteDataset ( string connectionString, string commandText ) : DataSet

Executes a single SQL command and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method.

ExecuteNonQuery ( MySqlConnection connection, string commandText ) : int

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.

ExecuteNonQuery ( string connectionString, string commandText ) : int

Executes a single command against a MySQL database. A new MySqlConnection is created using the MySqlConnection.ConnectionString given.

ExecuteReader ( MySqlConnection connection, string commandText ) : MySqlDataReader

Executes a single command against a MySQL database.

ExecuteReader ( string connectionString, string commandText ) : MySqlDataReader

Executes a single command against a MySQL database.

ExecuteScalar ( MySqlConnection connection, string commandText ) : object

Execute a single command against a MySQL database.

ExecuteScalar ( string connectionString, string commandText ) : object

Execute a single command against a MySQL database.

UpdateDataSet ( string connectionString, string commandText, DataSet ds, string tablename ) : void

Updates the given table with data from the given DataSet

Private Methods

Method Description
ExecuteReader ( MySqlConnection connection, MySql.Data.MySqlClient.MySqlTransaction transaction, string commandText, MySqlParameter commandParameters, bool ExternalConn ) : MySqlDataReader

Executes a single command against a MySQL database, possibly inside an existing transaction.

MySqlHelper ( ) : System.Data
makeCharClassArray ( ) : CharClass[]
needsQuoting ( string s ) : bool

Method Details

DoubleQuoteString() public static method

public static DoubleQuoteString ( string value ) : string
value string
return string

EscapeString() public static method

Escapes the string.
public static EscapeString ( string value ) : string
value string The string to escape
return string

ExecuteDataRow() public static method

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.
public static ExecuteDataRow ( string connectionString, string commandText ) : DataRow
connectionString string Settings to be used for the connection
commandText string Command to execute
return DataRow

ExecuteDataset() public static method

Executes a single SQL command and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged after execution of this method.
public static ExecuteDataset ( MySqlConnection connection, string commandText ) : DataSet
connection MySqlConnection object to use
commandText string Command to execute
return DataSet

ExecuteDataset() public static method

Executes a single SQL command and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed during this method.
public static ExecuteDataset ( string connectionString, string commandText ) : DataSet
connectionString string Settings to be used for the connection
commandText string Command to execute
return DataSet

ExecuteNonQuery() public static 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.
public static ExecuteNonQuery ( MySqlConnection connection, string commandText ) : int
connection MySqlConnection object to use
commandText string SQL command to be executed
return int

ExecuteNonQuery() public static method

Executes a single command against a MySQL database. A new MySqlConnection is created using the MySqlConnection.ConnectionString given.
public static ExecuteNonQuery ( string connectionString, string commandText ) : int
connectionString string to use
commandText string SQL command to be executed
return int

ExecuteReader() public static method

Executes a single command against a MySQL database.
public static ExecuteReader ( MySqlConnection connection, string commandText ) : MySqlDataReader
connection MySqlConnection object to use for the command
commandText string Command text to use
return MySqlDataReader

ExecuteReader() public static method

Executes a single command against a MySQL database.
public static ExecuteReader ( string connectionString, string commandText ) : MySqlDataReader
connectionString string Settings to use for this command
commandText string Command text to use
return MySqlDataReader

ExecuteScalar() public static method

Execute a single command against a MySQL database.
public static ExecuteScalar ( MySqlConnection connection, string commandText ) : object
connection MySqlConnection object to use
commandText string Command text to use for the command
return object

ExecuteScalar() public static method

Execute a single command against a MySQL database.
public static ExecuteScalar ( string connectionString, string commandText ) : object
connectionString string Settings to use for the update
commandText string Command text to use for the update
return object

UpdateDataSet() public static method

Updates the given table with data from the given DataSet
public static UpdateDataSet ( string connectionString, string commandText, DataSet ds, string tablename ) : void
connectionString string Settings to use for the update
commandText string Command text to use for the update
ds DataSet containing the new data to use in the update
tablename string Tablename in the dataset to update
return void