数据显示问题
以下程序运行到Set MSFlexGrid1.DataSource = rs句时报,"实时错误91,对象变量或with块变量未设置",请问怎么解决Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i As Integer
Dim j As Integer
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=test;Data Source=622yax"
conn.Open
rs.Open "select * from material", conn, 3, 1
i = rs.RecordCount
MSFlexGrid1.Rows = i + 1
MSFlexGrid1.Cols = 6
MSFlexGrid1.TextMatrix(0, 0) = "物料代码"
MSFlexGrid1.TextMatrix(0, 1) = "物料名称"
MSFlexGrid1.TextMatrix(0, 2) = "物料批次"
MSFlexGrid1.TextMatrix(0, 3) = "入库数量"
MSFlexGrid1.TextMatrix(0, 4) = "出库数量"
MSFlexGrid1.TextMatrix(0, 5) = "库存量"
Set MSFlexGrid1.DataSource = rs
rs.Close
conn.Close