急!VB操作Access问题!在线等!高分!

2024-12-16 04:50:27
推荐回答(3个)
回答1:

写代码之前你需要引用ado 控件
具体的办法是添加部件的对话框中选中
microsoft Active Data ...Object control 这句不是很记得怎么写了。
Private Sub command1_click()
dim conn as new adodb.connection
dim rs as new adodb.recordset
dim str as string
dim sql as string
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & str & "\Indicator.mdb"
conn.open str
rs.cursorlocation=aduseclient
sql="select * from Indicator order by Serial"
rs.open sql,conn,adopenkeyset.adlockpessimistic
上面是连接和打开数据库的代码.

回答2:

看“我的消息”

回答3:

我的消息