111,120
社区成员
发帖
与我相关
我的任务
分享
string sqlStr1,sqlStr2,sqlStr3;
sqlStr1 = "update TBL_BookInfoMX set state='1',ReaderID='" + this.ReaderID + "',JCCS=JCCS+1 WHERE BookID='" + BookID + "'";
sqlStr2 = "update TBL_ReaderInfo set yjsl=yjsl+1 where ReaderID='" + this.ReaderID + "'";
sqlStr3 = "INSERT INTO TBL_BookBorrow VALUES ('"+this.ReaderID+"','"+BookID+"',Getdate(),null,0)";
DataBase DB = new DataBase();
SqlConnection conn = DB.getDbConnection();
try
{
conn.Open();
SqlCommand cmd1 = new SqlCommand(sqlStr1, conn);
cmd1.ExecuteNonQuery();
//将TBL_ReaderInfo中的YJSL+1
SqlCommand cmd2 = new SqlCommand(sqlStr2, conn);
cmd2.ExecuteNonQuery();
//将记录插入TBL_BookBorrow中
SqlCommand cmd3 = new SqlCommand(sqlStr2, conn);
cmd3.ExecuteNonQuery();
}
finally
{
conn.Close();
}
return true;