VB图书管理系统毕业论文 第13页
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()
www.751com.cnDim 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 '权限相关
Frame2.Enabled = False
End If
Set DataGrid1.DataSource = rs_reader
'cmdcancel.Enabled = False
Exit Sub
loaderror:
MsgBox Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set DataGrid1.DataSource = Nothing
rs_reader.Close
End Sub
9、文件名frmaddreaderinfo(frmaddreaderinfo.frm)
功能说明:添加读者信息,包括读者的姓名、性别、读者类别、登记日期、电话号码、工作单位、家庭地址等信息。
源代码:
Option Explicit
Dim rs_addreader As New ADODB.Recordset
Private Sub Command1_Click()
Dim sql As String
If Trim(Combo1.Text) = "" Then
MsgBox "请选择读者种类", vbOKOnly + vbExclamation, ""
Combo1.SetFocus
Exit Sub
End If
If Trim(Text1.Text) = "" Then
MsgBox "读者姓名不能为空", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "读者编号不能为空", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Exit Sub
End If
sql = "select * from 读者信息 where 读者编号='" & Text2.Text & "'"
rs_addreader.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_addreader.EOF Then
rs_addreader.AddNew
rs_addreader.Fields(0) = Trim(Text1.Text)
rs_addreader.Fields(1) = Trim(Text2.Text)
rs_addreader.Fields(2) = Trim(Combo2.Text)
rs_addreader.Fields(3) = Trim(Combo1.Text)
rs_addreader.Fields(4) = Trim(Text3.Text)
rs_addreader.Fields(5) = Trim(Text4.Text)
rs_addreader.Fields(6) = Trim(Text5.Text)
rs_addreader.Fields(7) = CDate(Text6.Text) << 上一页 [11] [12] [13] [14] [15] [16] 下一页
VB图书管理系统毕业论文 第13页下载如图片无法显示或论文不完整,请联系qq752018766