Dim sql As String
On Error GoTo delerror
book_num = DataGrid1.Columns(3).CellValue(DataGrid1.Bookmark)
reader_num = DataGrid1.Columns(1).CellValue(DataGrid1.Bookmark)
answer = MsgBox("确定要还这本书吗?", vbYesNo, "")
If answer = vbYes Then
sql = "select * from 借阅信息 where 书籍编号='" & book_num & "'"
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Delete
rs_back.Update
rs_back.Close
sql = "select * from 书籍信息 where 书籍编号='" & book_num & "'"
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Fields(7) = "否"
rs_back.Update
rs_back.Close
sql = "select * from 读者信息 where 读者编号='" & reader_num & "'"
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Fields(8) = rs_back.Fields(8) - 1
rs_back.Update
rs_back.Close
If findform = True Then
Command1_Click
Else
Command2_Click
End If
MsgBox "成功删除!", vbOKOnly + vbExclamation, ""
DataGrid1.AllowDelete = False
Else
Exit Sub
End If
delerror:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
rs_reader.Close
sql = "select * from 借阅信息"
rs_book.CursorLocation = adUseClient
rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not rs_book.EOF Then
Do While Not rs_book.EOF
Combo3.AddItem rs_book.Fields(3)
Combo4.AddItem rs_book.Fields(4)
rs_book.MoveNext
End If
rs_book.Close
End Sub
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18]