Пример #1
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;
		}
Пример #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);
			}
		}
Пример #3
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);
			}
		}
Пример #4
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();
		}
Пример #5
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);
			}
		}
Пример #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();
			}
		}