private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         li = new library();
         string query = "update addingBooks SET titleBook = '" + textBox2.Text + "', authorBook = '" + textBox3.Text + "', quantity ='" + Convert.ToInt32(textBox4.Text) + "', placeLibrary='" + comboBox1.Text + "', conditionBook='" + comboBox2.Text + "' where serialNo= " + Convert.ToInt32(textBox1.Text);
         li.updateBook(query);
         dataGridView1.DataSource = goFill().Tables[0];
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (FormatException)
     {
         MessageBox.Show("Insert All Values!!", "Alert!!");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            dg.query = "SELECT serialNo,titleBook,authorBook,quantity,placeLibrary,conditionBook from addingBooks where quantity >" + 0;
            dataGridView1.DataSource = dg.goFill().Tables[0];
            sd = new showingData();
            li = new library();
            string queryForCount = "select count(studentID) from IssueBooks where studentID = " + comboBox1.Text;

            countingAdmissions = sd.countAdmission(queryForCount);

            numberOfQuantity = li.checkQuantity(Convert.ToInt32(comboBox2.Text));
            if (countingAdmissions >= limit)
            {
                MessageBox.Show("Return previous Books!!", "Alert");
            }
            else
            {
                if (numberOfQuantity > 0)
                {
                    string querya  = "Select bookID from IssueBooks where studentID =" + comboBox1.Text;
                    string checkID = li.alreadyExitsBook(querya);
                    if (comboBox2.Text != checkID)
                    {
                        string query = "insert into IssueBooks(studentID,studentName,takenBooks,maxAllowed,bookID,issueDate,lastDate)values('" + comboBox1.Text + "','" + textBox2.Text + "','" + Convert.ToInt32(textBox1.Text) + "','" + Convert.ToInt32(textBox3.Text) + "','" + comboBox2.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')";
                        li = new library();
                        li.updateBook(query);
                        li.minusQuantity(Convert.ToInt32(comboBox2.Text));

                        MessageBox.Show("Book has been issued Successfully!!!");
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("This book is already Issued to you!!");
                    }
                }
                else
                {
                    MessageBox.Show("Book quantity is zero!!", "Alert");
                }
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Enter all values", "Alert!!");
         }
         else
         {
             li = new library();
             string query = "INSERT into libraryMembershipForm(registrationNo,firstName,booksTaken,maxAllowed,feeStudent,paymentStudent) values('" + comboBox1.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox2.Text + "','" + textBox4.Text + "')";
             li.updateBook(query);
         }
     }
     catch (OleDbException)
     {
         MessageBox.Show("User already exits", "Alert!!");
     }
 }