Re: Stored Procedures

From: Anthony M. Davis (davisam2_at_bellsouth.net)
Date: 05/21/04

  • Next message: Anders Altberg: "Re: Stored Procedures"
    Date: Fri, 21 May 2004 08:23:29 -0400
    
    

    Hi Egbert. I'm able to call my stored procedure okay, but I'm only getting a
    return_value back as opposed to a result set (my stored proc uses SELECT
    rather than UPDATE). Here's the code I included in my original post:

    OleDbCommand selectCMD = new OleDbCommand("GetSurcharges", conn);
      selectCMD.CommandType = CommandType.StoredProcedure;
      selectCMD.CommandTimeout = 30;

      OleDbDataAdapter da = new OleDbDataAdapter();
      da.SelectCommand = selectCMD;

      conn.Open();

      DataSet ds = new DataSet();
      da.Fill(ds);

      DataView dv = new DataView(ds.Tables[0]);

      grdSurcharges.DataSource = dv;
      grdSurcharges.DataBind();

      conn.Close();

    DataGrid Output:

    return_value
    True

    My test stored procedure is defined as:

    PROCEDURE GetSurcharges
        SELECT * FROM surcharge_application

        * note to readers: this proc will be more complex. i'm only using a
    simple SELECT for test purposes.. otherwise, i have no problem changing the
    OleDbCommand to "SELECT * FROM surcharge_application" and retrieving a
    result set
    ENDPROC

    Thanks for all your input,

    Tony

    "Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
    message news:%23D4JMByPEHA.3012@tk2msftngp13.phx.gbl...
    > "Anthony M. Davis" <tony@fnwarranty.com> wrote in message
    > news:OGbG9suPEHA.1312@TK2MSFTNGP12.phx.gbl...
    > > Sorry, I guess I don't understand.. Isn't SQL Pass-Through for accessing
    > SQL
    > > Server data from FoxPro? Please remember my data is all in FoxPro dbf's
    > and
    > > the stored procedure I'm calling via VFPOLEDB is in the container
    > .DBC/.DCT.
    > >
    > > Again, all I'm trying to do is use OleDb to call a VFP-stored procedure
    > and
    > > obtain a result set. I'm now wondering if it is not possible to obtain
    > > result sets from VFP stored procedures via OleDb?? (i.e. need to upsize
    to
    > > SQL Server if i want to make use of stored procedures in this manner?)
    > >
    >
    > Hi,
    >
    > In access, a stored procedure looks like
    >
    > PARAMETERS name Text(50), id Long;
    > UPDATE tblName
    > SET lastname = [name]
    > WHERE name_id = [id]
    >
    > You can access or declare this stuff using ADO (use a ADODB.Command object
    > with declared parameters and use the jet provider) as if it were a stored
    > proc. I suspect for 90% that something equal must be possible with
    Foxpro...
    >


  • Next message: Anders Altberg: "Re: Stored Procedures"

    Relevant Pages

    • Re: Update statement performance decreases in stored proc
      ... Have you had a look at the execution plan of the stored procedure? ... Here are the important parts of the stored proc: ... I found that this was casued by the UPDATE statement at the end ...
      (microsoft.public.sqlserver.programming)
    • Re: RETURN_VALUES ??? done... What have I gained?
      ... b (aka whipper-snapper) ... > similar questions via stored proc and can set up a function to do the work ... >> tAdoDataSet is really easy to use. ... >> dataset even though you are pointing to a stored procedure. ...
      (borland.public.delphi.database.ado)
    • Re: RETURN_VALUES ??? done... What have I gained?
      ... Who is Doctor Codd? ... similar questions via stored proc and can set up a function to do the work ... > tAdoDataSet is really easy to use. ... > dataset even though you are pointing to a stored procedure. ...
      (borland.public.delphi.database.ado)
    • TableAdapter, INNER JOINs, stored procs, and problems with Update
      ... I have a stored procedure that uses JOINs to return columns from multiple ... I also have another stored proc that that takes a series of params ... @ac2 int, ...
      (microsoft.public.dotnet.framework.aspnet)
    • RE: Repost - Sql Server 2005 - SSIS - nbr of input cols < nbr stored proc parameters (MS
      ... proc parameters ... | file and insert them into an existing table using an 'insert stored proc' ... | inputs for all the stored proc parameters but the flat file only contains ... | and a stored procedure that inserts records into our lkp_county table ...
      (microsoft.public.sqlserver.dts)