Wednesday, March 7, 2012

Call SP from VB using optional parameters

Evenyone,
I am using VB6 ADO command object to call Stored procedure. the SP have
lots of paramters, some of parameters have already been given default
values. To that parameters that have defalut values, I don't want to
create these parameter objects when calling SP from VB side. But it
seems doesn't work. It seems you must give each parameters. It pass
parameter by position, not by name. I know in SQL Server, SP can call
another SP by passing parameter by name.
Some idea about this? Thanks for your help.
Cheers,
Robert Song
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
For VB6 there is a stored procedure add-in that you can download for
free from msdn (search for "ADO Stored Procedure Add-In"). Follow the
instructions for installing it as an add-in, and it will take care of
generating the parameters and all the rest of the ADO code you need
for calling your stored procedures.
--Mary
On Wed, 29 Sep 2004 11:31:40 -0700, robert song
<robert.song@.modelsoftcorp.com> wrote:

>Evenyone,
>I am using VB6 ADO command object to call Stored procedure. the SP have
>lots of paramters, some of parameters have already been given default
>values. To that parameters that have defalut values, I don't want to
>create these parameter objects when calling SP from VB side. But it
>seems doesn't work. It seems you must give each parameters. It pass
>parameter by position, not by name. I know in SQL Server, SP can call
>another SP by passing parameter by name.
>Some idea about this? Thanks for your help.
>Cheers,
>Robert Song
>*** Sent via Developersdex http://www.codecomments.com ***
>Don't just participate in USENET...get rewarded for it!
|||Hi Mary,
I can't find that add-in download link, Can you pls give me that?
Thanks
Cheers,
Robert Song
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||I wasn't able to find the msdn link to download the official version,
but googling "Microsoft ADO Stored Procedure Add-In" gave several
promising hits from developers elaborating on the original.
--Mary
On Thu, 30 Sep 2004 14:53:03 -0700, robert song
<robert.song@.modelsoftcorp.com> wrote:

>Hi Mary,
>I can't find that add-in download link, Can you pls give me that?
>Thanks
>Cheers,
>Robert Song
>*** Sent via Developersdex http://www.codecomments.com ***
>Don't just participate in USENET...get rewarded for it!
|||Mary,
Thank you for your reply.
I already got the solution even if i didn't install the add-in. By
setting commmandObj.NamedParameters = True, I can pass named
parameters,not by postions of parameters.
By the way, I am always trying to find a way to debuging the Stored
procedure during the VB6 run time for long time. I am meaning
continusely debugging VB code and SP code. Any suggest about that?
Thanks
Cheers,
Robert Song
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Better google that one too--there's kb articles and advice on that,
but getting it to actually work is another story. Attempting to debug
stored procedures from VB is a real PITA that most people have just
given up on. I always recommend using Query Analyzer rather than
wasting the time and energy on VB6 configuration for debugging sprocs.
--Mary
On Fri, 01 Oct 2004 08:52:00 -0700, robert song
<robert.song@.modelsoftcorp.com> wrote:

>Mary,
>Thank you for your reply.
>I already got the solution even if i didn't install the add-in. By
>setting commmandObj.NamedParameters = True, I can pass named
>parameters,not by postions of parameters.
>By the way, I am always trying to find a way to debuging the Stored
>procedure during the VB6 run time for long time. I am meaning
>continusely debugging VB code and SP code. Any suggest about that?
>Thanks
>Cheers,
>Robert Song
>*** Sent via Developersdex http://www.codecomments.com ***
>Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment