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

Prepare() private method

private Prepare ( int cursorPageSize ) : void
cursorPageSize int
return void
        private void Prepare(int cursorPageSize)
        {
            using (new CommandTimer(Connection, CommandTimeout))
            {
                // if the length of the command text is zero, then just return
                string psSQL = CommandText;
                if (psSQL == null ||
                     psSQL.Trim().Length == 0)
                    return;

                if (CommandType == CommandType.StoredProcedure)
                    statement = new StoredProcedure(this, CommandText);
                else
                    statement = new PreparableStatement(this, CommandText);

                statement.Resolve(true);
                statement.Prepare();
            }
        }

Same methods

MySqlCommand::Prepare ( ) : void

Usage Example

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