Exemplo n.º 1
0
        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;
        }