calling stored procedure in ADO.NET 2.0

Discussion in 'ASP .Net' started by David Sagenaut, Oct 24, 2005.

  1. How can I calling a stored procedure (say "sp_example") in ADO.NET 2.0? I
    used to do this in ADO.NET 1.1, but in 2.0 (beta2 vs2005), after the
    following
    ...
    sqlConnection con = new sqlConnection(strCon)
    sqlCommand cmd = sqlCommand("sp_example", con);
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.???

    under the Parameters property, I only find the AddRange() and AddWithValue()
    method, but not the Add() method which is in ADO.NET 1.1. Does anyone have
    an idea how to call a stored procedure in the new 2.0 framwork? Thanks in
    advance.

    David
     
    David Sagenaut, Oct 24, 2005
    #1
    1. Advertising

  2. David Sagenaut

    Karl Seguin Guest

    You might want to check out:
    http://weblogs.asp.net/jackieg/archive/2005/03/22/395517.aspx?Pending=true

    it explains why the change and how to get around it. I believe it's now a 2
    line operation. Without knowing exactly which overload of Add you wanted to
    use, I can't say exactly what the equivillant is..

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/
    "David Sagenaut" <> wrote in message
    news:p5V6f.1056$0V6.46@trndny06...
    > How can I calling a stored procedure (say "sp_example") in ADO.NET 2.0? I
    > used to do this in ADO.NET 1.1, but in 2.0 (beta2 vs2005), after the
    > following
    > ...
    > sqlConnection con = new sqlConnection(strCon)
    > sqlCommand cmd = sqlCommand("sp_example", con);
    > cmd.CommandType = CommandType.StoredProcedure;
    >
    > cmd.Parameters.???
    >
    > under the Parameters property, I only find the AddRange() and
    > AddWithValue()
    > method, but not the Add() method which is in ADO.NET 1.1. Does anyone
    > have
    > an idea how to call a stored procedure in the new 2.0 framwork? Thanks in
    > advance.
    >
    > David
    >
    >
     
    Karl Seguin, Oct 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nita
    Replies:
    1
    Views:
    905
    Saravana
    Nov 20, 2004
  2. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    491
    Kevin Spencer
    Dec 17, 2004
  3. Mike P
    Replies:
    0
    Views:
    3,374
    Mike P
    Jun 19, 2006
  4. Quinet, Joel
    Replies:
    0
    Views:
    508
    Quinet, Joel
    Aug 8, 2003
  5. Jeremy
    Replies:
    4
    Views:
    289
    Bob Barrows
    Jul 31, 2003
Loading...

Share This Page