Ejemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            index_str = dataGridView1.CurrentRow.Index;
            string           query3 = "SELECT r_dostup FROM rabotniki WHERE r_id = " + Convert.ToString(dataGridView1[0, index_str].Value);
            OleDbDataAdapter dat    = new OleDbDataAdapter(query3, myConnection);

            DataTable dt1 = new DataTable();
            DataTable dt  = new DataTable();

            dat.Fill(dt);
            //int status = Convert.ToInt32();
            if (Convert.ToInt32(dt.Rows[0][0]) == 1)
            {
                MessageBox.Show("Запись занята другим пользователем");
            }
            else
            {
                index_str   = dataGridView1.CurrentRow.Index;
                peredachaID = Convert.ToInt32(dataGridView1[0, index_str].Value);

                string query4 = "UPDATE rabotniki SET r_dostup=1 WHERE r_id =" + Convert.ToString(peredachaID);

                OleDbCommand updat = new OleDbCommand(query4, myConnection);
                updat.ExecuteNonQuery();

                myConnection.Close();

                Form14 newForm = new Form14(this, peredachaID);
                newForm.Show();
            }
        }
Ejemplo n.º 2
0
        public Form5(Form14 f14)
        {
            InitializeComponent();
            var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            myConnection = new OleDbConnection(connectionString);
            myConnection.Open();
            f14.Close();
        }