早起鳥有蟲吃
級別: 略有小成
|
圖片:
'各位好! '咨詢下使用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 ········································ |
---|---|
|
吾志所向
級別: 家園常客
|
PLC與數據庫通訊有專門的智能網關的,支持PLC跟數據庫之間雙向通訊, 包括MySQL,SQLServer,PostgreSQL等都支持, 一個網關支持多臺PLC的,相關案例: 多臺PLC對接數據庫.zip (2445 K) 下载次数:8 |
---|---|
|