private void issue_movie_info_Click(object sender, EventArgs e) { Rental_Field instance = new Rental_Field(); if (instance.Customer_Record(Convert.ToInt32(rentalInfo_csID.Text.ToString())) < 2) { DataTable tbl = new DataTable(); tbl = instance.Record("select * from Movie_Field where Movie_Id=" + Convert.ToInt32(videorental_ID.Text.ToString()) + ""); int copies = Convert.ToInt32(tbl.Rows[0]["Copies"].ToString()); if (instance.Movie_Record(Convert.ToInt32(videorental_ID.Text.ToString())) < copies) { instance.Rental_Insert(Convert.ToInt32(rentalInfo_csID.Text.ToString()), Convert.ToInt32(videorental_ID.Text.ToString()), IssueDtp.Text); DataTable tbl1 = new DataTable(); tbl1 = instance.Rental_Record(); tjGridview.DataSource = tbl1; viInfo_Genre.Text = ""; viInfo_Plot.Text = ""; viInfo_copies.Text = ""; viInfo_cost.Text = ""; viInfo_year.Text = ""; viInfo_points.Text = ""; viInfo_Name.Text = ""; videorental_ID.Text = ""; csInfo_City.Text = ""; csInfo_Contact.Text = ""; csInfo_email.Text = ""; csInfo_Name.Text = ""; rentalInfo_csID.Text = ""; } else { MessageBox.Show("All the Movies Copies all already Issued "); } } else { MessageBox.Show("you already issued two movie so can't issue more "); } }