Esempio n. 1
0
        private void Insertbtn_Click(object sender, EventArgs e)
        {
            string connStr = "server=localhost;user=root;database=birjha_truda;";
            // создаём объект для подключения к БД
            MySqlConnection connection = new MySqlConnection(connStr);

            connection.Open();
            string sql = "INSERT INTO `soiskateli`(`id_users`, `Last_name`, `Name`, `Father_name`, `Pol`, `Age`, `Pasport`, `Info`) VALUES " +
                         "(NULL, '" + Fam.Text + "','" + Ima.Text + "','" + Otch.Text + "','" + Pol.Text
                         + "','" + Age.Text + "','" + Pasport.Text + "','" + Inf.Text + "');";
            MySqlCommand command = new MySqlCommand(sql, connection);

            command.ExecuteNonQuery();
            connection.Close();
            Ima.Clear();
            Fam.Clear();
            Otch.Clear();
            Pol.Clear();
            Pasport.Clear();
            Age.Clear();
            Inf.Clear();
        }