高手求助!斑竹求助! 点击:990 | 回复:0



永远有多远

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:10帖 | 109回
  • 年度积分:0
  • 历史总积分:168
  • 注册:2003年10月25日
发表于:2005-09-05 17:29:00
楼主
我现在用VB脚本编数据库连接的程序: dim obj,objconncection,objcommand,connectstring dim a,ssjrksq ssjrksq=hmiruntime.tags("ssj1rksq").read connectstring="provider=msdasql;dsn="cc_zxf_05_09_02_12_39_31r;username=;pwd=;" set objconnection=createobject("adodb.connection") objconnection.connetion=connectionstring objconnection.open set objcommand=createobject("adodb.command") set obj=createobject("adodb.recordset") 前面的数据库连接我可能写的有点错误,(凭记忆写的),可以不用考虑他会出问题。主要是后面的: a="select * from zlmlb where kou=1;" with objcommand .connection=objconnection .commandtext=a end with set obj=objcommand.execute if (ssjrksq=1) then hmiruntime.tags("ssjxflsh").write obj.fields(0).value end if set objcommand=nothing objconnection.close set objconection=nothing 遇到的问题是数据库连接上后,当有多条记录满足条件时,WINCC会将这几条记录依次全部下发给PLC。而我只想下发一条记录。怎样才能从获得的多条记录中得到首条纪录呢? 而且满足条件的记录全部下发后又会显示错误说:当前没有记录。 请问怎样才能判断当前有没有满足条件的记录?若没有记录时就不下发PLC命令。 写的有点多,不过实在是没有办法了,请高手帮忙,谢谢!急!


热门招聘
相关主题

官方公众号

智造工程师