VB图书管理系统毕业论文 第14页
rs_addreader.Update
MsgBox "添加读者信息成功!", vbOKOnly, ""
rs_addreader.Close
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Else
MsgBox "读者编号重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
rs_addreader.Close
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo2.AddItem "男"
Combo2.AddItem "女"
Dim rs_leibie As New ADODB.Recordset
Dim sql As String
sql = "select * from 读者类别"
rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_leibie.MoveFirst
Do While Not rs_leibie.EOF
Combo1.AddItem rs_leibie.Fields(0)
rs_leibie.MoveNext
Loop
rs_leibie.Close
End Sub
10、文件名 frmreaderinfo(frmreaderinfo,frm)
功能说明:读者信息管理,可以修改和删除读者的信息。
源代码:
Option Explicit
Dim rs_reader As New ADODB.Recordset
Private Sub cmdcancel_Click()
rs_reader.CancelUpdate
DataGrid1.Refresh
DataGrid1.AllowAddNew = False
DataGrid1.AllowUpdate = False
cmdmodify.Enabled = True
cmddel.Enabled = True
cmdcancel.Enabled = False
cmdupdate.Enabled = False
End Sub
Private Sub cmddel_Click()
Dim answer As String
On Error GoTo delerror
answer = MsgBox("确定要删除吗?", vbYesNo, "")
If answer = vbYes Then
DataGrid1.AllowDelete = True
rs_reader.Delete
rs_reader.Update
DataGrid1.Refresh
MsgBox "成功删除!", vbOKOnly + vbExclamation, ""
DataGrid1.AllowDelete = False
Else
Exit Sub
End If
delerror:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Private Sub cmdmodify_Click()
Dim answer As String
On Error GoTo cmdmodify
cmddel.Enabled = False
cmdmodify.Enabled = False
cmdupdate.Enabled = True
cmdcancel.Enabled = True
DataGrid1.AllowUpdate = True
cmdmodify:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Private Sub Command5_Click()
rs_reader.Update
DataGrid1.Refresh
End Sub
Private Sub cmdupdate_Click()
If Not IsNull(DataGrid1.Bookmark) Then
rs_reader.Update
End If
cmdmodify.Enabled = True
cmddel.Enabled = True
cmdcancel.Enabled = False
cmdupdate.Enabled = False
DataGrid1.AllowUpdate = False
MsgBox "保存成功!", vbOKOnly + vbExclamation, ""
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
On Error GoTo loaderror
sql = "select * from 读者信息"
rs_reader.CursorLocation = adUseClient
rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic '打开数据库
cmdupdate.Enabled = False
'设定datagrid控件属性
DataGrid1.AllowAddNew = False '不可增加
DataGrid1.AllowDelete = False '不可删除
DataGrid1.AllowUpdate = False
If userpow = "guest" Then '权限相关
<< 上一页 [11] [12] [13] [14] [15] [16] 下一页
VB图书管理系统毕业论文 第14页下载如图片无法显示或论文不完整,请联系qq752018766