[求助]请问如何利用datagrid控件来显示ADODB连接的数据?
用adodc很简单,用DataSource设置就可以了,但现在我想引用ADODB来访问数据库
就不知是如何来显示数据了。希望各位帮忙!谢谢
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim connstr As String
connstr = "连接字符。。。。。。。"
conn.ConnectionString = connstr
conn.Open connstr
rs.CursorLocation = adUseClient
rs.Open 表名, conn, adOpenKeyset, adLockPessimistic
'.........................
'.........................
call showdata
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
MsgBox "查询成功", , "提示"'用来测试连接是否成功
end sub
sub showdata()
'================================
如果是用text来显示数据在这里加上代码,在上面调用还可以,但我显示想用datagrid来显示数据,请问该如何去编写呢?望帮忙指教!Text1 = rs.Fields(第几字段)
end sub