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之前都没问题,可是到这条语句就不执行了,为什么?请各位大侠帮忙!!!