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

技成培訓(xùn)網(wǎng) 技成學(xué)習(xí)APP 技成工具箱 技成企業(yè)服務(wù)

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

技成培訓(xùn)網(wǎng)

電工題庫寶典

技成電工課堂

PLC練習(xí)題

技成PLC課堂

變頻器故障查詢

技成PLC學(xué)吧

伺服驅(qū)動(dòng)故障查詢

技成PLC網(wǎng)校

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

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

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

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

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

佳答案

wincc的sql不是普通的sql,它是壓縮的,可以存儲(chǔ)更多的數(shù)據(jù),查詢可以實(shí)現(xiàn),如果你要向里面插入數(shù)據(jù),我個(gè)人認(rèn)為你還是利用其他的數(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'查看是否到記錄結(jié)束
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

若有收獲,就點(diǎn)個(gè)贊吧!

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

微信掃一掃分享

閱讀與本文標(biāo)簽相同的文章

相關(guān)推薦

最新文章 熱門文章
最新課程 免費(fèi)課程
PLC資料下載 電工電氣資料下載
應(yīng)用新秀
變頻器故障代碼查詢APP
伺服故障代碼查詢APP
技成
手機(jī)APP
熱門標(biāo)簽