Exemplo n.º 1
0
 public static DataSet ExecuteDataset(string connectionString, string commandText, params MySqlParameter[] commandParameters)
 {
     using (MySqlConnection connection = new MySqlConnection(connectionString))
     {
         connection.Open();
         return ExecuteDataset(connection, commandText, commandParameters);
     }
 }
Exemplo n.º 2
0
 public static int ExecuteNonQuery(string connectionString, string commandText, params MySqlParameter[] parms)
 {
     using (MySqlConnection connection = new MySqlConnection(connectionString))
     {
         connection.Open();
         return ExecuteNonQuery(connection, commandText, parms);
     }
 }
Exemplo n.º 3
0
 public static void UpdateDataSet(string connectionString, string commandText, DataSet ds, string tablename)
 {
     MySqlConnection connection = new MySqlConnection(connectionString);
     connection.Open();
     MySqlDataAdapter adapter = new MySqlDataAdapter(commandText, connection);
     new MySqlCommandBuilder(adapter).ToString();
     adapter.Update(ds, tablename);
     connection.Close();
 }
Exemplo n.º 4
0
 public static object ExecuteScalar(string connectionString, string commandText, params MySqlParameter[] commandParameters)
 {
     using (MySqlConnection connection = new MySqlConnection(connectionString))
     {
         connection.Open();
         return ExecuteScalar(connection, commandText, commandParameters);
     }
 }
Exemplo n.º 5
0
 public static MySqlDataReader ExecuteReader(string connectionString, string commandText, params MySqlParameter[] commandParameters)
 {
     MySqlDataReader reader;
     MySqlConnection connection = new MySqlConnection(connectionString);
     connection.Open();
     try
     {
         reader = ExecuteReader(connection, null, commandText, commandParameters, false);
     }
     catch
     {
         connection.Close();
         throw;
     }
     return reader;
 }
Exemplo n.º 6
0
		public override void Cancel() {
			if( !this.connection.driver.Version.isAtLeast( 5, 0, 0 ) ) {
				throw new NotSupportedException( Resources.CancelNotSupported );
			}
			MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder( this.connection.Settings.GetConnectionString( true ) );
			builder.Pooling = false;
			using( MySqlConnection connection = new MySqlConnection( builder.ConnectionString ) ) {
				connection.Open();
				new MySqlCommand( string.Format( "KILL QUERY {0}", this.connection.ServerThread ), connection ).ExecuteNonQuery();
			}
		}