您好GoodMorning我实际上遇到了datagridview
的问题- 问题是,当我再次开始搜索那本书时,它显示的值为1,这将允许我再次借用那本书
这是我的复习代码
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "select *from Books";
command.CommandText = query;
OleDbDataAdapter da = new OleDbDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
dataview6.DataSource = dt;
connection.Close();
这是我借书的代码
private void borrow()
{
try
{
connection.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = connection;
cmd.CommandText = "UPDATE Books Set Copies = Copies -1 WHERE BOOK_NUMBER = " + bkn_num.Text + "";
cmd.ExecuteNonQuery();
MessageBox.Show("Book Has Been Borrowed");
connection.Close();
}
catch (Exception ex)
{
}
}