VB data控件的用法

来源:百度知道 编辑:UC知道 时间:2024/06/12 18:47:35
做一个简单的应用data控件可对数据库进行添加,删除,查询操作的系统。请给出具体代码和注释,如果能给发个演示程序最好,高分悬赏。

Private Sub Command1_Click() '“上一个”按钮
Data1.Recordset.MovePrevious
Command2.Enabled = True
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Command1.Enabled = False
End If
End Sub
Private Sub Command2_Click() '“下一个”按钮
Data1.Recordset.MoveNext
Command1.Enabled = True
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Command2.Enabled = False
End If
End Sub
Private Sub Command3_Click() '“添加”按钮
Data1.Recordset.AddNew
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command3.Enabled = False
Text1.SetFocus
End Sub
Private Sub Command4_Click() '“删除”按钮
i = MsgBox("确定删除该记录", 52, "信息提示")
If i = 6 Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub
Private Sub Command5_Click()
If Text6.Text = "" Then