Re: Returning OUTPUT variables

From: Nickl (Nickl_at_discussions.microsoft.com)
Date: 01/17/05


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"
>
>
>



Relevant Pages

  • Re: Legal Text truncated and not displaying commas properly
    ... Thanks for the reply Bob. ... as modifying the legal text in the DDP? ... > I have had a lot of problems when using XP workstations with SP1 to modify ... > my default domain policy and when I had fellow admins modify or even ...
    (microsoft.public.windows.server.active_directory)
  • Re: Connecting to a specific computer via Remote Desktop
    ... "Bob" wrote in message ... > savvy enough to modify this to my situation. ... > find similar instructions that are Linksys WRT54G router and XP Pro SP2 ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: current date and time object
    ... Doesn't show the date though - can I modify the code to ... I'll try moving it to my sheet here in a minute... ... >> Bob, ...
    (microsoft.public.excel)
  • Re: string upper, string lower, string subthisforthat
    ... |>used to modify it's arguments, ... | But it does appear that the Standard will be changed to fit common ... Thanks Bob. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: TDD: Test-Driven Design or Test-Driven Development?
    ... Source code describes the ... There is no compiler for the BOB language. ... One reason no genuine model driven design OO engineer considers design to be ... The Code Subsystem is one of often many other major DEPLOYMENT SUBSYSTEMS. ...
    (comp.object)

Loading