Dim cnn As New ADODB.Connection Dim strsql As String Dim rs As New ADODB.Recordset ' cnn.ConnectionString=......设置连接字符串 'strSQL = "SELECT * FROM table1 where ...."设置记录集 With rs .CursorLocation = adUseClient .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open strsql, cnn, , , adCmdUnknown End With Set datagrid1.DataSource = rs
Dim strsql As String
Dim rs As New ADODB.Recordset
' cnn.ConnectionString=......设置连接字符串
'strSQL = "SELECT * FROM table1 where ...."设置记录集
With rs
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strsql, cnn, , , adCmdUnknown
End With
Set datagrid1.DataSource = rs
偶试了几次都绑定不了,试试!