【编程开发】AspAsp.NetCGIPHPJspXMLPERLC++C#VCVBDelphiPowerBuilderJAVA汇编数据库编程移动开发其它语言

您现在的位置:首页 > 网络学院 > 编程开发 > VB > VB+Access设计图书管理系统

VB+Access设计图书管理系统

来源: 作者: 日期:2006-09-04

【聚杰网VB】VB+Access设计图书管理系统

  DataGrid1.AllowDelete = False

  Else

  Exit Sub

  End If

  delerror:

  If Err.Number <> 0 Then

  MsgBox Err.Description

  End If

  End Sub

  Private Sub Form_Load()

  Dim sql As String

  On Error GoTo loaderror

  sql = "select * from 值班管理"

  rs_zhiban.CursorLocation = adUseClient

  rs_zhiban.Open sql, conn, adOpenKeyset, adLockPessimistic ' 打开数据库

  ' 设定DataGrid控件属性

  DataGrid1.AllowAddNew = False ' 不可增加

  DataGrid1.AllowDelete = False ' 不可删除

  DataGrid1.AllowUpdate = False

  Set DataGrid1.DataSource = rs_zhiban

  Exit Sub

  loaderror:

  MsgBox Err.Description

  End Sub

  Private Sub Form_Unload(Cancel As Integer)

  Set DataGrid1.DataSource = Nothing

  rs_zhiban.Close

  End Sub

  (8) 投诉管理子窗体代码

  投诉管理子窗体是为了对人员进行更好的管理而设置的,可以向其添加投诉的对象、时间和内容等。投诉管理运行后的子窗体如图45所示。

  

  图45 运行的投诉管理子窗体

  以下为窗体的代码:

  Private Sub Command1_Click()

  On Error GoTo adderr

  Text1.SetFocus

  Adodc1.Recordset.AddNew

  Exit Sub

  adderr:

  MsgBox Err.Description

  End Sub

  Private Sub Command2_Click()

  On Error GoTo deleteerr

  With Adodc1.Recordset

  If Not .EOF And Not .BOF Then

  If MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then

  .Delete

  .MoveNext

  If .EOF Then .MoveLast

  End If

  End If

  End With

  Exit Sub

  deleteerr:

  MsgBox Err.Description

  End Sub

  Private Sub Command3_Click()

  Adodc1.Recordset.MovePrevious

  If Adodc1.Recordset.BOF Then

  MsgBox "这是第一条记录", vbOKCancel + vbQuestion

  Adodc1.Recordset.MoveFirst

  End If

  End Sub

  Private Sub Command4_Click()

  Adodc1.Recordset.MoveNext

  If Adodc1.Recordset.EOF Then

  MsgBox "这是最后一条记录", vbOKCancel + vbQuestion

  Adodc1.Recordset.MoveLast

  End If

  End Sub

  Private Sub Command5_Click()

  If Adodc1.Recordset.EOF Then

  MsgBox "记录空", vbOKCancel + vbQuestion

  End

  Else

  Adodc1.Recordset.MoveFirst

  End If

  Exit Sub

  End Sub

  Private Sub Command6_Click()

  If Adodc1.Recordset.RecordCount = 0 Then

  MsgBox "空记录", vbOKCancel + vbQuestion

  End

  Else

  Adodc1.Recordset.MoveLast

  End If

  End Sub

  Private Sub Command7_Click()

  MDIForm1.Show

  frmtousu.Hide

  End Sub

  到这里,各个窗体的界面和代码都介绍完了。发布后可以作为一个实际的项目应用。

上一页 1 2 3 4 5 6 7 8 9

以下相关文章您是否也应该阅读一下 无相关信息
评论   点击查看全部评论
您的评论参与,将为聚杰带来更大的动力!请不要吝啬!
快速回复
请使用文明语言让我们维护健康绿色网络环境!

匿名发表   验证码: