MySql.Data.MySqlClient.MySqlCommand.Prepare C# (CSharp) Method

Prepare() public method

public Prepare ( ) : void
return void
		public override void Prepare()
		{
			if (connection == null)
				throw new InvalidOperationException("The connection property has not been set.");
			if (connection.State != ConnectionState.Open)
				throw new InvalidOperationException("The connection is not open.");
			if (connection.Settings.IgnorePrepare)
				return;

			Prepare(0);
		}
		#endregion

Same methods

MySqlCommand::Prepare ( int cursorPageSize ) : void

Usage Example

コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string Connect = "Database=vlad_m;Data Source=192.168.27.79;User Id=vlad_m;charset=cp1251;Password=vlad19957";
                MySql.Data.MySqlClient.MySqlConnection myConnection = new MySql.Data.MySqlClient.MySqlConnection(Connect);
                MySql.Data.MySqlClient.MySqlCommand    myCommand    = new MySql.Data.MySqlClient.MySqlCommand();
                myConnection.Open();
                myCommand.Connection  = myConnection;
                myCommand.CommandText = string.Format("TRUNCATE TABLE result"); //запрос: если есть такой логин в таблице
                myCommand.Prepare();                                            //подготавливает строку
                myCommand.ExecuteNonQuery();                                    //выполняет запрос


                myCommand.CommandText = string.Format("INSERT INTO result SELECT ok.id_dog FROM ok,import_adress WHERE import_adress.id=ok.id_dog"); //запрос: если есть такой логин в таблице
                myCommand.Prepare();                                                                                                                 //подготавливает строку
                myCommand.ExecuteNonQuery();                                                                                                         //выполняет запрос

                myConnection.Close();
                MessageBox.Show("Result!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlCommand::Prepare