高手請教!我現在用VB腳本編數據庫連接的程序: dim obj,objco cection,objcommand,co ectstring dim a, jrksq jrksq=hmiruntime.tags(" j1rksq").read co ectstring="provider=msdasql;d ="cc_zxf_05_09_02_12_39_31r;username= wd=;" set objco ection=createobject("adodb.co ection") objco ection.co etion=co ectio tring objco ection.open set objcommand=createobject("adodb.command") set obj=createobject("adodb.recordset") 前麵的數據庫連接我可能寫的有點錯誤,(憑記憶寫的),可以不用考慮他會出問題。主要是後麵的: a="select * from zlmlb where kou=1;" with objcommand .co ection=objco ection .commandtext=a end with set obj=objcommand.execute if ( jrksq=1) then hmiruntime.tags(" jxflsh").write obj.fields(0).value end if set objcommand=nothing objco ection.close set objconection=nothing 遇到的問題是數據庫連接上後,當有多條記錄滿足條件時,WINCC會將這幾條記錄依次全部下發給PLC。而我隻想下發一條記錄。怎樣才能從獲得的多條記錄中得到首條紀錄呢? 而且滿足條件的記錄全部下發後又會顯示錯誤說:當前沒有記錄。 請問怎樣才能判斷當前有沒有滿足條件的記錄?若沒有記錄時就不下發PLC命令。 寫的有點多,不過實在是沒有辦法了,請高手幫忙,謝謝!急!