• It's quite easy to build true, reusable command objects in VB.  We do it this way (this is an update only command, so no return parameters:

    Static cmdUpdate as adodb.command

          If cmdUpdate is Nothing Then

            Set cmdUpdate = New ADODB.Command

            With cmdUpdate

              .ActiveConnection = GL_Conn

              .CommandText = "UpdateOrderItemOptions"

              .CommandType = adCmdStoredProc

              .Parameters.Append .CreateParameter("@ID", adGUID)

              .Parameters.Append .CreateParameter("@CUpdated", adBoolean)

              .Parameters.Append .CreateParameter("@VUpdated", adBoolean)

              .Parameters.Append .CreateParameter("@Checked", adBoolean)

              .Parameters.Append .CreateParameter("@UseDirect", adBoolean)

              .Parameters.Append .CreateParameter("@DirectCost", adCurrency)

              .Parameters.Append .CreateParameter("@VendorCost", adCurrency)

            End With

          End If

          cmdUpdate.Parameters("@ID").Value = !ID

          cmdUpdate.Parameters("@CUpdated").Value = !CUpdated

          cmdUpdate.Parameters("@VUpdated").Value = !VUpdated

          cmdUpdate.Parameters("@Checked").Value = !Checked

          cmdUpdate.Parameters("@UseDirect").Value = !UseDirect

          cmdUpdate.Parameters("@DirectCost").Value = !DirectCost

          cmdUpdate.Parameters("@VendorCost").Value = !VendorCost

         

          cmdUpdate.Execute , , adExecuteNoRecords

    With this method, you only "create" the command once, then you fill it with variables as often as you like.  I greatly prefer to create each parameter specifically, it's really not that much trouble.


    Student of SQL and Golf, Master of Neither