private void button3_Click(object sender, EventArgs e) { int num = Convert.ToInt32(textBox3.Text); bok = LibraryDB.GetBooks(num); if (bok == null) { MessageBox.Show("The book has not been found"); } else { this.DisplayBooks(); } button4.Visible = true; button5.Visible = true; label5.Visible = true; label7.Visible = true; label2.Visible = true; label3.Visible = true; label1.Visible = true; label16.Visible = true; label17.Visible = true; label18.Visible = true; textBox11.Visible = true; textBox4.Visible = true; textBox1.Visible = true; textBox6.Visible = true; textBox2.Visible = true; comboBox4.Visible = true; comboBox5.Visible = true; comboBox6.Visible = true; textBox11.ReadOnly = true; textBox4.ReadOnly = true; textBox1.ReadOnly = true; textBox2.ReadOnly = true; }
private void button3_Click(object sender, EventArgs e) { int num = Convert.ToInt32(textBox3.Text); bok = LibraryDB.GetBooks(num); if (bok == null) { MessageBox.Show("The book has not been found"); } else { this.DisplayBooks(); } int a = Convert.ToInt32(textBox6.Text); if (a == 0) { MessageBox.Show("The book is not in stock at the moment!"); } }
private void button1_Click(object sender, EventArgs e) { int num = Convert.ToInt32(textBox3.Text); bok = LibraryDB.GetBooks(num); if (bok == null) { MessageBox.Show("The book has not been found"); } else { button3.Enabled = true; button5.Enabled = true; this.DisplayBooks(); } OleDbConnection conn = LibraryDB.GetConnection(); DataTable dt = new DataTable(); OleDbDataAdapter adapter = new OleDbDataAdapter("select * from Books Where (BookID=@id)", conn); adapter.SelectCommand.Parameters.AddWithValue("@bookid", textBox3.Text); adapter.Fill(dt); dataGridView1.DataSource = dt; }