July 27, 2006 at 3:58 pm
Hey everybody, I'm working in a store procedure with parameters and I want to show to user when some parameter's value is bad or is missed.
I check the parameter's value in the store procedure and if something is bad, stop the execution with "RETURN 50001", but I don't know how to catch the return's value.
I'm working with SqlServer 2000 and vb 6.0
Something like this:
IN SQL SERVER
sp_checksome
@parameter1 varchar2(20),@parameter2 int
as
if len(@parameter1)=0
begin
return 50001
end
IN VISUAL BASIC
private function updsome(byval strProcName as string, byval CxnConexion as ADODB.Connection,Paramarray arrParameters() as variant)
Dim objCmd As ADODB.Command
Set objCmd = New ADODB.Command
With objCmd
.CommandText = strProcName
.CommandType = adCmdStoredProc
Set .ActiveConnection = CxnConexion
For varIndex = 0 To UBound(arrParameters)
.Parameters(varIndex + 1).Value = arrParameters(varIndex)
Next
.Execute Options:=adExecuteNoRecords
How to catch the return's value?
end with
July 28, 2006 at 4:20 am
For the command object, check out property Direction with value adParamReturnValue
N 56°04'39.16"
E 12°55'05.25"
July 28, 2006 at 4:20 am
For the command object, check out property Direction with value adParamReturnValue
N 56°04'39.16"
E 12°55'05.25"
July 28, 2006 at 9:12 am
Thanks Peter, but the direction of the parameters is input in the store procedure, I have to change it to inputoutput?
July 28, 2006 at 1:01 pm
Microsoft says you just ad the parameter to the command object, never initialize it, and after excuting the stored procedure, check the value of the parameter.
The return_value parameter is a special kind of parameter, Please read more about it in the help files.
N 56°04'39.16"
E 12°55'05.25"
July 28, 2006 at 5:38 pm
Thank you, I'm going to do it this weekend.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply