wincc中访问数据库SQL

已锁定

baozizzy

  • 帖子

    26
  • 精华

    0
  • 被关注

    1

论坛等级:游民

注册时间:2005-09-03

普通 普通 如何晋级?

wincc中访问数据库SQL

1645

9

2010-07-15 14:31:55

Sub X6309X94AE3X0000X0000_X6309X94AE3X0000X8BDD_X6309X94AE3X0000C_X6309X94AE3X0000i_OnClick(ByVal Item)

Dim objConnection
Dim objCommand
Dim objRcordset
Dim strConnectionString
Dim strSQL


Dim number
Dim name
Dim grade
Dim ingCount

Dim var1
Dim var2
Dim var3

number=HMIRuntime.Tags("Number1").Read
HMIRuntime.Tags ("number_write").Write number



strConnectionString="Provider=MSDASQL.1;Persist Security Info=False;Data Source=MY_DATABASE"
strSQL="select * from table1 where Number="&number&""
Set objConnection=CreateObject("ADODB.Connection")
objConnection.ConnectionString=strConnectionString
objConnection.Open
'MsgBox "ok"
Set objRecordset=CreateObject("ADODB.Recordset")
'MsgBox "ok"
Set objCommand=CreateObject("ADODB.Command")
objCommand.CommandType=1
objCommand.ActiveConnection=objConnection
objCommand.CommandText=strSQL
'MsgBox "ok"
Set objRecordset=objCommand.Execute
MsgBox "ok"
用msgbox诊断发现,代码Set objRecordset=objCommand.Execute之前都没问题,可是到这条语句就不执行了,为什么?请各位大侠帮忙!!!
wincc中访问数据库SQL 已锁定
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32755条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。