Re: calling stored procedure with optional parameter



How is the SP defined? Are there default values supplied for the optional
parameters?

I expect you'll need to request "Named Parameters" so you can provide a
sparse Parameter list.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"wk6pack" <wkwan@xxxxxxxxxx> wrote in message
news:%235ueWCVkFHA.3692@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> Is it possible to call a stored procedure from vb.net when some of the
> parameters are not required in the stored procedure?
> Say i have a stored procedure with 3 parameters. I want to call the
> stored
> procedure with only two of the parameters.
> I seem to get an error saying I need the 3rd parameter. When I fill in
> the
> 3 parameter the sql statement call from vb.net works fine.
>
> code:
> cmd.CommandText = "InsertVSIS"
> cmd.CommandType = adCmdStoredProc
> cmd.Parameters.Append cmd.CreateParameter("@studentkey", adInteger,
> adParamInput,,lstudentkey)
>
>
> thanks,
> Will
>
>


.



Relevant Pages

  • Re: Function and Request are not good friends
    ... stored procedure and the view. ... access this request. ... > In MDB you can use: nothing, ... > But I think you want to put into source property SQL string, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Processing queries simultaneously
    ... Thanks for the suggestion on the stored procedure. ... The clustered index is in Packet_contract, ... If I force the query to use one processor, will it slow down this query? ... > In order for SQL Server to use more than 1 processor to process a request ...
    (microsoft.public.sqlserver.programming)
  • Re: Sometimes error in same page
    ... > I have a simple page with a grid on it based on a stored procedure ... An unhandled exception occurred during the execution of the ... > current web request. ... How complicated is the stored procedure ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Function and Request are not good friends
    ... A> stored procedure. ... A> - I did not succeed to include directly in my Form Source the request: ... But I think you want to put into source property SQL string, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Function and Request are not good friends
    ... stored procedure. ... > A> In my MDB application I use a request (Included in the source ... > If its source of form, you can set parameters value in ... > InputParameters property. ...
    (microsoft.public.access.adp.sqlserver)