Set cnn = New ADODB.Connection
cnn.Open ConnectString
MsgBox ConnectString
txtSQL = "SELECT * FROM DWB"
Set rsDw = New ADODB.Recordset
rsDw.Open txtSQL, cnn, adOpenKeyset, adLockOptimistic
If rsDw.EOF Then
MsgBox "aa"
Else
MsgBox "bb"
End If
Set DataGrid1.DataSource = rsDw
怎么DataGrid1中没有显示阿,表中有数据
cnn.Open ConnectString
MsgBox ConnectString
txtSQL = "SELECT * FROM DWB"
Set rsDw = New ADODB.Recordset
rsDw.Open txtSQL, cnn, adOpenKeyset, adLockOptimistic
If rsDw.EOF Then
MsgBox "aa"
Else
MsgBox "bb"
End If
Set DataGrid1.DataSource = rsDw
怎么DataGrid1中没有显示阿,表中有数据
解决方案 »
- 请问VB+SQL 可以直接同步数据库吗?
- VB DataGrid1 列未找到
- vb语音识别控件
- 怎样用vb制作超链接那样的label
- 用VB如何得到一个应用程序的版本号?
- 加速dao问题
- 如何读取EXECEL文件中指定单元格中的内容!!!(100分)
- 在DataGrid1控件中自动填充数据
- 一只笨鸟,想交一些肯真心帮我的,朋友!!!
- ★★简单问题送高分★★:已知一颜色值为long型,如何确定它的R,G,B值分别是多少?
- ado recordset open的问题
- 请教 New、CreateObject及GetObjectContext.CreateInstance的适用场合和主要区别,谢谢!!!
rsDw.CursorLocation = adUseClient
试试
使用由本地游标库提供的客户端游标
不设置这个应该也可以吧?
为里还要看你具体有几列,再自己添加看看!
For i = 1 To rsDw.RecordCount
DataGrid1.AddItem Empty
DataGrid1.TextMatrix(i, 1) = rsDw.Fields(0).Value
DataGrid1.TextMatrix(i, 2) = rsDw.Fields(1).Value
DataGrid1.TextMatrix(i, 3) = rsDw.Fields(2).Value
DataGrid1.TextMatrix(i, 4) = rsDw.Fields(3).Value
DataGrid1.TextMatrix(i, 5) = rsDw.Fields(4).Value
rs1.MoveNext
Next
用这个吧