'各位好!
'咨询下使用Wincc MShflexgrid连接SQLserver数据库时,想显示数据库中所有内容,但是激活后只显示一行数据是怎么回事,实际数据库中有40条数据。
'以下部分前后有省略,代码如下:
················································
ssql1= "SELECT * FROM [Data].[dbo].[Recipe]"
Set oCom.ActiveConnection = Conn
oCom.CommandText = ssql1
Set oRs1 = oCom.Execute
m = oRs1.RecordCount
'---------------------设置控件显示--------------------'
Dim alllist
Set alllist = ScreenItems("报表")
alllist.clear
alllist.Cols=8
alllist.Rows = m+1
'---------------------将数据写入表格--------------------'
oRs1.Movefirst
For i = 1 To m
alllist.TextMatrix(i,0) = i
alllist.TextMatrix(i ,1) = oRs1.fields(0).Value
alllist.TextMatrix(i ,2) = oRs1.Fields(1).Value
alllist.TextMatrix(i ,3) = oRs1.Fields(2).Value
alllist.TextMatrix(i ,4) = oRs1.Fields(3).Value
alllist.TextMatrix(i ,5) = oRs1.Fields(4).Value
alllist.TextMatrix(i ,6) = oRs1.Fields(5).Value
alllist.TextMatrix(i ,7) = oRs1.Fields(6).Value
alllist.TextMatrix(i ,8) = oRs1.Fields(7).Value
oRs1.movenext
Next
········································