在wincc中,我用的ado连接sql,然后把找到的数据显示在MSHFlexGrid中。
如果只查一个数据没问题:
Set oCom = CreateObject("ADODB.Command")
oCom.CommandType = 1
Set oCom.ActiveConnection = conn
oCom.CommandText = sSql
Set oRs = CreateObject("ADODB.Recordset")
Set oRs = oCom.Execute
可是现在要查很多数据,所以用了
Set oCom1 = CreateObject("ADODB.Command")
oCom1.CommandType = 1
Set oCom1.ActiveConnection = conn
oCom1.CommandText = sSql1
Set oRs1 = CreateObject("ADODB.Recordset")
MsgBox 1
Set oRs1 = oCom1.Execute
MsgBox 2
想再查另一个数据,在第2段代码中,msgbox 1 能运行,可是 msgbox 2 就不能运行了。说明:Set oRs1 = oCom1.Execute 有问题。错误显示:参数不正确。
为什么呢?如何解决呢?请高手帮忙解答下,谢谢!