Dim nowdate As Date = Date.Now
Dim ReturnDate As Date = nowdate.AddDays(datenum)
Dim sqlstr As String = "insert into LendInfo(BookID,UserID,LendDate,ReturnDate,IsBack)values( "
sqlstr += "'" + BookID + "'"
sqlstr += ",'" + UserID + "'"
sqlstr += ",'" + nowdate.ToShortDateString + "'"
sqlstr += ",'" + ReturnDate.ToShortDateString + "'"
sqlstr += ",0)"
ExecNonSql(sqlstr)
Return True
End Function
Public Function GetMax(ByVal UserID As String) As Integer
Dim sqlstr As String = "select BookNum from Users where UserID='" + UserID + "'"
Dim myreader As SqlDataReader = ExecReaderSql(sqlstr)
Dim num As Integer = 0
If myreader.Read Then
num = myreader("BookNum")
End If
myConn.Close()
Return num
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str As String = ""
Dim BookID As String = GetBookID()
If GetCurNum(txtUserID.Text) >= GetMax(txtUserID.Text.ToString) Then
Response.Write("<script>javascript:alert('借书数已满!!!');</script>")
Return
End If
Dim state As Integer = GetBookState(BookID)
If state = 1 Then
LendBook(txtUserID.Text.ToString.Trim, BookID)
Else
Select Case state
Case -2 : Response.Write("<script>javascript:alert('此书不在流通状态或此书不存在!!!');</script>")
Case -1 : Response.Write("<script>javascript:alert('此书不在书架上!!!
<< 上一页 [21] [22] [23] [24] [25] 下一页