Re: Returning OUTPUT variables
From: Nickl (Nickl_at_discussions.microsoft.com)
Date: 01/17/05
- Next message: Muhammad Hammad via SQLMonster.com: "Re: Reporting Service URL Settings"
- Previous message: Jonas Karlsson: "Strange problem with extended property in SQL Server and Access ad"
- In reply to: Bob Barrows [MVP]: "Re: Returning OUTPUT variables"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 Jan 2005 00:29:02 -0800
Thanks Bob, your Magic worked a treat. I will check out your code too.
Cheers
Nick
"Bob Barrows [MVP]" wrote:
> Nickl wrote:
> > When I run the proc in the debugger, the @Return_Value = 10, but When
> > I run the code, the value of intRowCount remains at 0, which is its
> > initial value. Any ideas?
>
> Did you set intRowCount equal to the value of the parameter after executing
> the procedure? You need to do that. It's not going to automagically happen.
> See below:
> >
> > "Ed" wrote:
> >
> >> I would like to suggest you purchase some good books to read more...
> >> try this
> >>
> >> Dim cmd As New ADODB.Command
> >> Set cmd.ActiveConnection = CurrentProject.Connection
> >> cmd.CommandText = "SecondTry"
> >> cmd.CommandType = adCmdStoredProc
> >>
> >> cmd.Parameters.Append cmd.CreateParameter("Output", adint,
> >> adParamOutput )
> >>
> >> cmd.Execute
> >> MsgBox "Output"
>
> This is incorrect. It should be:
>
> MsgBox cmd.Parameters("Output").value
>
> In your case, you would do this:
> intRowCount = cmd.Parameters("Output").value
>
> There's a VB addin that will generate the createparameter statements for
> you. You will need to have VB installed in order to use it, although if you
> read te source code, you should be able to modify it and put it in a VBA
> module. While you're modifying it, make sure you make it correctly handle
> numeric/decimal datataypes, whose Precision and NumericScale properties need
> to be set before assigning values. I've done that in the tool I created for
> ASP which is available at:
> http://www.thrasherwebdesign.com/downloads1/sp_parameters.zip
>
> It's available at Bill Vaughn's website: www.betav.com
>
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>
- Next message: Muhammad Hammad via SQLMonster.com: "Re: Reporting Service URL Settings"
- Previous message: Jonas Karlsson: "Strange problem with extended property in SQL Server and Access ad"
- In reply to: Bob Barrows [MVP]: "Re: Returning OUTPUT variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|