运行后在MSFlexGrid没任何数据显示,怎么改?
Public cnTest As New ADODB.Connection
Public Function connectSybase() As Boolean
On Error GoTo ErrHandle
Dim strConnect As String
strConnect = "Provider=MSDASQL.1;DRIVER={Sybase System 11}; " _
& " Persist Security Info=False;DSN=;" _
& " SRVR=user_14;DB=esmart;UID=sa;PWD=888888"
connectSybase = True
Exit Function
ErrHandle:
connectSybase = False
End Function
Private Sub Form1_Load()
Dim rsTest As New ADODB.Recordset
Dim strSQL As String
If connectSybase Then
strSQL = "Select * from User_Info_Table" 'strSQL可以是SQL语句(块),存储过程
rsTest.CursorLocation = adUseClient
rsTest.Open strSQL, cnTest 'cnTest为打开的活动的连接
Else
MsgBox "打开数据库失败"
Exit Sub
End If
Set MSFlexGrid1.DataSource = rsTest
MSFlexGrid1.Refresh
End Sub