Sub OnClick(ByVal Item)
Dim conn1,oCom1,oRs1,oCom2,oRs2,oCom3,oRs3,objConn
Dim con
dim strsql
strsql="select * from Table_1"'where [序号]=3
Set conn1=Createobject("ADODB.Connection")
con = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=123456;Intial Catalog=wincctest;Data Source=XCGDQ02\WINCC;"
conn1.ConnectionString=con
conn1.CursorLocation = 3
conn1.Open
Set oRs1=Createobject("ADODB.Recordset")
Set oCom1=Createobject("ADODB.Command")
oCom1.CommandType=1
With oCom1
.ActiveConnection = conn1
.CommandText = strsql
End With
Msgbox "4"
Set oRs1=conn1.Execute
Msgbox "5"
Msgbox oRs1.RecordCount
End Sub
用wincc的vb脚本与sql server连接,每次执行都会停止在Set oRs1=conn1.Execute 这一段,后面的无法执行,有大佬知道原因吗?