probles executing SP in VBScript

  • Thread starter Thread starter Dan Pavel
  • Start date Start date
D

Dan Pavel

Hi,

I am trying to execute a SP in VBScript. The SP is returning multiple
rows and it's working fine. When I try to execute it from VBScript I get
this error: "ADODB.Recordset: Operation is not allowed when the object
is closed."
This is the part of code:

Dim MyConn, cmd, myRec
Dim cc
Dim GLDate,GLAccount
Dim strSQL

Set MyConn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set myRec = CreateObject( "ADODB.Recordset" )

MyConn.Open strConn

cmd.CommandText = "gldata_fo"
Set cmd.ActiveConnection = MyConn
cmd.CommandType = 4
cmd.Parameters.Refresh
cmd.Parameters("@Date") = "11/14/2005"
Set myRec = cmd.Execute
While Not myRec.EOF
GLDate=myRec.Fields(0).Value
GLAccount=myRec.Fields(1).Value

myRec.MoveNext

Wend
MyConn.Close()

What am I doing wrong ?
Please help.

Thanks,
Dan
 
Back
Top