Command Object

Results 1 to 3 of 3

Thread: Command Object

  1. #1
    Join Date
    Dec 1969

    Default Command Object

    I need to use a command object in a loop to execute a stored proc. that accepts input parameters and returns output parameters. Do I need to create and destroy the object on each iteration of the loop to clear the parmeters collection?<BR><BR>For i = 1 to 10 <BR>set oCmd = server.CreateObject("ADODB.Command")<BR> oCmd.CommandText = "sp_name"<BR> oCmd.ActiveConnection = MyConn<BR> oCmd.CommandType = adCmdStoredProc<BR> oCmd.Parameters.Append .CreateParameter("p1",adInteger, adParamInput, 30, i)<BR> oCmd.Parameters.Append .CreateParameter("r1", adCurrency, adParamReturnValue, 4)<BR> oCmd.Execute<BR> ...<BR><BR> ...<BR> Set oCmd = Nothing<BR>Next<BR><BR>This works, but is there a way to use the same instance of the command object each time?<BR><BR>Thanks<BR>

  2. #2
    KPW Guest

    Default RE: Command Object

    There is a "Delete" method for the parameters collection, but I don&#039t see a "RemoveAll" method. Perhaps you could work with the Delete method, though.

  3. #3
    Join Date
    Dec 1969

    Default Thanks! Works Perfect


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts