文件名称:VB 使用DAO对象浏览数据库.rar
文件大小:8KB
文件格式:RAR
更新时间:2022-07-30 13:28:26
VB源码-数据库实例
VB 使用DAO对象浏览数据库 rs.MoveFirst '移动记录指针 Command1.Enabled = False '使第一条和上一条按钮不可用 Command2.Enabled = False Command3.Enabled = True Command4.Enabled = True refreshdb rs '调用自定义方法刷新 End Sub Private Sub Command2_Click() If rs.BOF Then'判断是否到了第一条记录之前 Command1.Enabled = False'使第一条和上一条按钮不可用 Command2.Enabled = False Else rs.MovePrevious End If Command3.Enabled = True Command4.Enabled = True refreshdb rs End Sub Private Sub Command3_Click() Command1.Enabled = True Command2.Enabled = True If rs.EOF Then'判断是否到了最后一条记录之后 Command3.Enabled = False'使下一条和最后一条按钮不可用 Command4.Enabled = False Else rs.MoveNext End If refreshdb rs End Sub Private Sub Command4_Click() rs.MoveLast Command1.Enabled = True Command2.Enabled = True Command3.Enabled = False '使下一条和最后一条按钮不可用 Command4.Enabled = False refreshdb rs End Sub Private Sub Command5_Click() End End Sub Private Sub refreshdb(rst As Recordset)'自定义刷新方法 Dim i As Integer If rst.EOF Or rst.BOF Then Exit Sub End If For i = 0 To 4 If IsNull(rst.Fields(i)) Then '判断是否有空值 Text1(i).Text = "" Else Text1(i).Text = rst.Fields(i).Value '为控件数组赋值 End If Next i End Sub
【文件预览】:
srcfans.com
----DAO对象浏览数据库()
--------E412.vbp(838B)
--------Form1.frm(6KB)
--------student.mdb(68KB)
--------MSSCCPRJ.SCC(189B)
--------E412.vbw(50B)