Results 1 to 8 of 8

How do you call a stored procedure?

This is a discussion on How do you call a stored procedure? within the Programming forums, part of the Web Designing & Development category; Create a command object, set the object’s CommandText property to the name of the stored procedure, and set the CommandType ...

  1. #1
    Senior Member Array
    Join Date
    Jul 2010
    Location
    India
    Posts
    139

    Default How do you call a stored procedure?

    Create a command object, set the object’s CommandText property to the name of the stored procedure, and set the CommandType property to StoredProcedure. To execute the stored procedure, use the command object’s ExecuteNonQuery, ExcecuteScalar, ExecuteReader, or ExecutelXmlReader method. For example, the following code calls the Ten Most Expensive Products stored procedure on the Northwind Traders database:

    // Create a connection for NorthWind Trader's database.
    SqlConnection connNWind = new SqlConnection("integrated security=SSPI;" +
    "data source=(local);initial catalog=Northwind");
    // Create a command object to execute.
    SqlCommand cmdTopTen = new SqlCommand(connNWind);
    cmdTopTen.CommandText = "Ten Most Expensive Products";
    // Set the command properties.
    cmdTopTen.CommandType = CommandType.StoredProcedure;
    // Create a data reader object to get the results.
    SqlDataReader drdTopTen;
    // Open the connection.
    connNWind.Open();
    // Excecute the stored procedure.
    drdTopTen = cmdTopTen.ExecuteReader();

  2. #2
    Member Array
    Join Date
    Nov 2010
    Posts
    94

    Default Re: How do you call a stored procedure?

    I enjoyed with your great effort

  3. #3
    Senior Member Array
    Join Date
    Jul 2010
    Location
    India
    Posts
    139

    Default Re: How do you call a stored procedure?

    Thank you for u supported me...........

  4. #4
    Member Array
    Join Date
    Nov 2010
    Posts
    80

    Default Re: How do you call a stored procedure?

    Hi,
    Thank you that you shared the your experience.

    Thank you..

  5. #5
    Junior Member Array
    Join Date
    Sep 2010
    Posts
    25

    Default Re: How do you call a stored procedure?

    Really such a nice info to call a stored procedure.. Thanks for sharing

  6. #6
    Senior Member Array
    Join Date
    Aug 2010
    Posts
    104

    Default Re: How do you call a stored procedure?

    Hello,

    I have gone through your post and you have explained the stored procedure perfectly. Thanks for sharing such informative post.

  7. #7
    Senior Member Array
    Join Date
    Mar 2011
    Posts
    110

    Default Re: How do you call a stored procedure?

    Thanks a lot for sharing your knowledge..............

  8. #8
    Senior Member Array
    Join Date
    Mar 2011
    Posts
    459

    Default Re: How do you call a stored procedure?

    thank you very much



Similar Threads

  1. Replies: 3
    Last Post: 04-07-2012, 11:47 AM
  2. Replies: 9
    Last Post: 08-14-2011, 11:30 AM
  3. Replies: 3
    Last Post: 04-04-2011, 12:01 PM
  4. Replies: 0
    Last Post: 06-22-2009, 12:58 PM
  5. what all information is stored in the server log in linux without...
    By shirin in forum Web & Server Administration
    Replies: 0
    Last Post: 02-06-2008, 04:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO Forum | Web Hosting Forum | Websites For Sale |