Best way to call a stored procedure - basic.visual

This is a discussion on Best way to call a stored procedure - basic.visual ; Hi There are two ways to execute a stored procedure using ADO - call "exec sp_myproc val1,val2" statement over ADO - use Command/Parameters objects to initialize and call the stored procedure. Which is a efficient way and why Appreciate your ...

+ Reply to Thread
Results 1 to 2 of 2

Best way to call a stored procedure

  1. Default Best way to call a stored procedure

    Hi

    There are two ways to execute a stored procedure using ADO
    - call "exec sp_myproc val1,val2" statement over ADO
    - use Command/Parameters objects to initialize and call the stored procedure.

    Which is a efficient way and why

    Appreciate your response

    Thanks
    Mike

  2. Default Re: Best way to call a stored procedure

    Mike wrote:
    > Hi
    >
    > There are two ways to execute a stored procedure using ADO
    > - call "exec sp_myproc val1,val2" statement over ADO
    > - use Command/Parameters objects to initialize and call the stored

    procedure.
    >
    > Which is a efficient way and why
    >
    > Appreciate your response
    >
    > Thanks
    > Mike


    I use both, depending on the circumstances. Stored procedures with few or
    no parameters I use the SQL statement call, especially if the parameters
    don't change programmatically. It's quick and painless.

    For more complex calls, or especially where I will call the SP repeatedly
    with different parameters, I set up a Command object and Parameter objects.
    If the SP returns a value via a parameter, I don't know of a way to get that
    value with the SQL statement approach, so you have to use the
    Command/Parameter approach. Finally, if the parameters are set up
    correctly, I find it a little easier to add/delete parameters with
    Command/Parameter approach than the SQL statement approach.

    As far as a performance is concerned, I don't know, except if you call the
    same procedure repeatedly, using the Command/Parameter approach is probably
    faster for subsequent calls.

    Austin
    --
    You programmed with 1s and 0s? We only had 0s!
    There are no X characters in my address


+ Reply to Thread

Similar Threads

  1. Trying to call a stored procedure from C# (and failing)
    By Application Development in forum ADO DAO RDO RDS
    Replies: 8
    Last Post: 08-26-2007, 04:08 PM
  2. Stored Procedure Call using EJB 3.0
    By Application Development in forum Java
    Replies: 0
    Last Post: 11-22-2006, 09:05 AM
  3. How to call a stored procedure with white space within?
    By Application Development in forum JDBC JAVA
    Replies: 0
    Last Post: 10-30-2006, 11:49 AM
  4. Replies: 0
    Last Post: 10-14-2005, 09:53 AM
  5. Call stored procedure in ASP.NET 2.0
    By Application Development in forum Inetserver
    Replies: 2
    Last Post: 09-24-2005, 12:59 PM