Peter
|
| Posted: 01/04/2003, 1:07 AM |
|
Hello,
I have a stored procedure for an Insert operation. I need to receive the identity field info for the inserted record back. Here is the code CCS generates for this:
----------------------------------------
Set Cmd.Connection = Connection
Cmd.CommandOperation = cmdExec
With Cmd
.CommandType = dsProcedure
.SP = "InsertPatient;1"
.CommandParameters = Array(
Array("@Patient_Name", "urlPatient_Name", adChar, adParamInput, 60, 0, 10, Empty, Empty), _
*************SOME MORE FIELDS******************** _
Array("@LastID", "urlLastID", adInteger, adParamOutput, 6, 0, 10, Empty, Empty))
End With
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteInsert", Me)
Cmd.Exec(Errors)
-----------------------------------
Here I need to know the value of LastID output parameter. How do I get this value? I tried Cmd.CommandParameters("@LastID").value, but it is not working. With CCP, I used to get this value as cmd.Parameters("@LastID").Value. What is the way with CCS?
Thanks
|
|
|
 |
Brandon
|
| Posted: 01/31/2003, 10:04 PM |
|
I'm having the same problem. Have you found any solutions?
|
|
|
 |
Gery
|
| Posted: 02/05/2003, 12:31 AM |
|
Hi,
I've already been posting a request for this and was told that ccs developers will solve it. That's how I worked around the problem. I added the following code to classes.asp at clsCommand at the end of Method DoExec:
If CommandType = dsProcedure Then
If IsArray(CommandParameters) Then
For I = 0 To UBound(CommandParameters)
If CommandParameters(I)(3) = adParamReturnValue Or _
CommandParameters(I)(3) = adParamInputOutput Or _
CommandParameters(I)(3) = adParamOutput Then
Parameters.ParameterSources(CommandParameters(I)(1)).Value = _
Command.Parameters(CommandParameters(I)(0)).Value
End If
Next
End If
End If
The result is that you can retreive output Parameters over the Command Class after execution of a stored procedure.
Regards,
Gery
|
|
|
 |
Ilannet
|
| Posted: 02/18/2003, 11:06 AM |
|
Hi Gery,
I am having the same problem you were having. I copied the code you posted to my class.asp page. Now, how do I display the Output parameters I get from the procedure? In my particular case, it would an error message if the procedure's input parameters validation didn't success. I am new to CodeCharge thus not very proficent at it.
Thank you so much for your help!!!
Ilannet
|
|
|
 |
|