创建一个工程文件,能对ACESS数据库的数据进行增加,删除=操作,急,在线=,谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/14 17:22:20
我一点都不会,明天就要交了,谢谢帮助!!!
我电脑上也没VB,上课基本没听过,对VB不懂,求求高手们!!!

Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset

Private Sub Command1_Click()
Set Rs = Conn.Execute("select * from A")
Rs.MoveFirst
MsgBox Rs!Name
End Sub

Private Sub Command2_Click()
Conn.Execute "update A set name = 'Leu' where id = 1"
End Sub

Private Sub Command3_Click()
Conn.Execute "delete from A where name = 'Leu'"
End Sub

Private Sub Form_Load()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False;Jet OLEDB:Database Password="
Conn.Open

End Sub

VB本身就自带一个数据库管理器的源程序的.可以参考一下.