计算机科学与工程学院
} } protected void bbsbtn_Click(object sender, EventArgs e) { seltUser.Enabled = false; OleDbConnection conn = CC.GetConnection(); string uno = this.bbktext.Text.ToString().Trim(); string sqlstr = \借书证号='\ + uno + \; OleDbCommand cmd = new OleDbCommand(sqlstr, conn); conn.Open(); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { TextBox7.Text = dr[\姓名\].ToString(); bbkList.Items.Add(new ListItem(dr[\借书证号\].ToString() + \ + dr[\姓名\].ToString() + \ + dr[\书籍编号\].ToString() + \ + dr[\书籍名称\].ToString() + \ + dr[\借书日期\].ToString(), dr[\书籍名称\].ToString())); } conn.Close(); } protected void blmbtn_Click(object sender, EventArgs e) { bbktext.Text = \; TextBox5.Text = \; TextBox6.Text = \; TextBox7.Text = \; bbkList.Items.Clear(); bbkinfo.Visible = true; bkinfo.Visible = false; UserInfo.Visible = false ; userreg.Visible = false; } protected void borrow_Click(object sender, EventArgs e) { string bno = \; string uno = bbktext.Text.ToString().Trim(); string uname = TextBox7.Text.ToString().Trim(); string bname = TextBox5.Text.ToString().Trim(); OleDbConnection conn = CC.GetConnection(); string sqlstr = \书籍名称='\ + bname + \; OleDbCommand cmd = new OleDbCommand(sqlstr, conn); conn.Open(); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { 《数据库系统原理》实验报告
21
计算机科学与工程学院
bno = dr[\书籍编号\].ToString(); } conn.Close(); string Sql = \into [Borrow] (借书证号,姓名,书籍编号,书籍名称,借书日期) values ('\ + uno + \ + uname + \ + bno + \ + bname + \ + TextBox6.Text.ToString().Trim() + \; try { CC.ExecSQL(Sql); } catch (Exception ex) { Response.Write(CC.MessageBox(ex.Message)); } } }
《数据库系统原理》实验报告 22