Private Sub Command2_Click()
CTS_sql = "SELECT * FROM cts_sell"
Set DataGrid1.DataSource = cts_select(CTS_sql) 实事错误:'7004'行集合不能作为标签
这又错在什么地方呀
DataGrid1.Refresh
end sub
Public Function cts_select(cts_string As String) As ADODB.Recordset
On Error GoTo cts_error
Set CTS_cn = New ADODB.Connection
Set CTS_rst = New ADODB.Recordset
CTS_cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CTS_vendition;Data Source=cts-t"
CTS_cn.Open
Set CTS_rst.ActiveConnection = CTS_cn
CTS_rst.LockType = adLockOptimistic
CTS_rst.CursorType = adOpenKeyset
CTS_rst.Open Trim(cts_string)
Set cts_select = CTS_rst
Set CTS_rst = Nothing
Set CTS_cn = Nothing
Exit Function
cts_error:
If cts_error(Err.Description) Then
Resume
Else
End
End If
End Function