Set findlist.MSHFlexGrid1.DataSource = rs 提示,“实时错误,要求对象”
Private Sub Command1_Click()MSHFlexGrid1.Cols = 500: MSHFlexGrid1.Rows = 500 '显示多少列多少行
MSHFlexGrid1.Col = 0: MSHFlexGrid1.Row = 0 '从第二行第二列显示
cn.ConnectionString = Str_Ado
cn.Open
rs.CursorLocation = adUseClient
rs.Open "select * from inventory where cinvcode='001'", cn, adOpenKeyset, adLockOptimistic
'like '% " & Trim(find.Text1.Text) & "% ' ", cn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "查无此人! "
Label1.Caption = Str$(0) + "人! "
findlist.MSHFlexGrid1.Clear
Else
Label1.Caption = Str$(rs.RecordCount) + "人! "
Set findlist.MSHFlexGrid1.DataSource = rs
End If
rs.Close
End Sub
'在模组里定义如下变量:
Public cn As New ADODB.Connection '通用连接资料库字串
Public rs As New ADODB.Recordset '通用获取记录集字串
Public Const Str_Ado = "Provider=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=ufhr;Data Source=zzh"
Public str_SQL As String '通用SQL查询字串
Public sql As String
Public sql1 As String
Public sql2 As String
Sub Main()
Form1.Show vbModal
End Sub
运行Command1_Click()
时提示,“实时错误,要求对象”,MSHFlexGrid1控件也添加了,Set findlist.MSHFlexGrid1.DataSource = rs 这句话提示 findlist是什么?
是不是应该这样写:
MSHFlexGrid1.Clear
...
Set MSHFlexGrid1.DataSource = rs
补充:VB , 数据库(包含打印,安装,报表)