999久久久精品国产消防器材,国产成人久久综合77777,√最新版天堂资源网在线,精品久久久久区二区8888,卡一卡二卡三乱码视频

技成培訓網(wǎng) 技成學習APP 技成工具箱 技成企業(yè)服務

歡迎回到技成培訓網(wǎng)

技成培訓網(wǎng)

電工題庫寶典

技成電工課堂

PLC練習題

技成PLC課堂

變頻器故障查詢

技成PLC學吧

伺服驅動故障查詢

技成PLC網(wǎng)校

當前位置:技成首頁 > 文章中心 > 技成百科 > 讀寫wincc中的sql數(shù)據(jù)

讀寫wincc中的sql數(shù)據(jù)

鄭志武 發(fā)布于2012-12-20 17:27 622 0 標簽:

wincc中如何通過寫腳本的方式將數(shù)據(jù)存儲到sql數(shù)據(jù)庫中,這個腳本好寫嗎?誰能提供一份腳本模版啊,謝謝!

問題補充:
麻煩你還發(fā)個寫到sql的程序過來好嗎?沒有sql程序的經(jīng)驗,真心不會啊

佳答案

wincc的sql不是普通的sql,它是壓縮的,可以存儲更多的數(shù)據(jù),查詢可以實現(xiàn),如果你要向里面插入數(shù)據(jù),我個人認為你還是利用其他的數(shù)據(jù)庫或者excel等保存這些數(shù)據(jù),查詢起來就簡單多了。查詢數(shù)據(jù)庫:
'創(chuàng)建到數(shù)據(jù)庫的鏈接
'創(chuàng)建數(shù)據(jù)庫聯(lián)接
spro="provider=winccoledbprovider.1;"
sdsn="catalog="&tagdnsname.value&";"
sser="datasource=.wincc"
scon=spro+sdsn+sser
setconn=createobject("adodb.connection")
conn.connectionstring=scon
conn.cursorlocation=3
conn.open
ssql="tag:r,('test estdata'),'"&utc_begin_time&"','"&utc_end_time&"'"
msgbox"openwith:"&vbcr&scon&vbcr&ssql&vbcr
setors=creatobject("adodb.recordset")
setocm=creatobject("adodb.command")
ocm.commandtype=1
setocm.activeconnection=conn
ocom.commandtext=ssql
'讀取數(shù)據(jù)
setors=ocm.execute
m=ors.recordcount
count_data=0.0
sum_data=0.0
if(m>0)then
dowhilenotors.eof'查看是否到記錄結束
sum=sum+ors.fields(0).value
count_data=count_data+1.0
ors.movenext
loop
elsemsgbox"沒有查詢到數(shù)據(jù)............."
item.enabled=true
setors=nothing
conn.close
setconn=nothing
endif
setors=nothing
conn.close
setconn=nothing

若有收獲,就點個贊吧!

文章來源于網(wǎng)絡及文獻如有侵權請聯(lián)系站長
分享到:

微信掃一掃分享

閱讀與本文標簽相同的文章

相關推薦

最新文章 熱門文章
最新課程 免費課程
PLC資料下載 電工電氣資料下載
應用新秀
變頻器故障代碼查詢APP
伺服故障代碼查詢APP
技成
手機APP
熱門標簽