Пример #1
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            this.Hide();
            Form15 form15 = new Form15();

            form15.Show();
        }
        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form15 form15 = new Form15();

            form15.Show();
        }
Пример #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            String          connection = "Provider=OraOLEDB.Oracle;Data Source=localhost;User Id=system;Password=system;OLEDB.NET=True";
            OleDbConnection obj3       = new OleDbConnection(connection);
            String          query1     = "select count(*) from current_borrowings where rid='" + comboBox1.Text + "'";
            OleDbCommand    cm4        = new OleDbCommand(query1, obj3);

            obj3.Open();
            OleDbDataReader rd    = cm4.ExecuteReader();
            Int64           count = 0;

            while (rd.Read())
            {
                count = int.Parse(rd[0].ToString());
            }
            obj3.Close();


            if (count == 0)
            {
                String query = "delete from reader where rid = '" + comboBox1.Text + "'";
                obj3.Open();
                try
                {
                    OleDbCommand cm = new OleDbCommand(query, obj3);
                    cm.ExecuteNonQuery();
                    MessageBox.Show("Reader Deleted from Database");
                }
                catch (Exception ee)
                {
                    MessageBox.Show("Error...Reader not Deleted");
                }
                obj3.Close();
            }
            else
            {
                MessageBox.Show("Please Settle all the borrowings of '" + textBox1.Text + "' before  deleting");
                this.Hide();
                Form15 form15 = new Form15();
                form15.Show();
            }
        }