Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int index = dataGridView1.CurrentRow.Index;

            int id = Convert.ToInt32(dataGridView1.Rows[index].Cells[0].Value);

            string cmd = "DELETE * FROM Autentification WHERE Code=" + id.ToString();

            string cmd1 = "SELECT Login,Password,User,Post FROM [Autentification]";


            OleDbDataAdapter dta1 = new OleDbDataAdapter(cmd, connstring);

            OleDbDataAdapter dta = new OleDbDataAdapter(cmd1, connstring);

            DataSet ds1 = new DataSet();

            dta1.Fill(ds1);

            DataSet ds = new DataSet();

            dta.Fill(ds);

            Delete_user dltus = new Delete_user();


            dltus.dataGridView1.DataSource = ds.Tables[0].DefaultView;

            this.Close();

            dltus.Show();
        }
Ejemplo n.º 2
0
        //Удаление пользователей
        private void удалитьПользователяToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string cmd = "SELECT Code,Login,Password,User,Post FROM [Autentification]";

                OleDbDataAdapter dta = new OleDbDataAdapter(cmd, connection_string);

                DataSet ds = new DataSet();

                dta.Fill(ds);

                Delete_user dltus = new Delete_user();


                dltus.dataGridView1.DataSource = ds.Tables[0].DefaultView;
                dltus.connstring = connection_string;
                dltus.Show();
            }
            catch
            {
                MessageBox.Show("Не верно выбрана база данных!");
            }
        }