Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:23:33+00:00 2026-05-11T10:23:33+00:00

Is there any benefit to explicitly using the StoredProcedure CommandType as opposed to just

  • 0

Is there any benefit to explicitly using the StoredProcedure CommandType as opposed to just using a Text Command? In other words, is

cmd = new SqlCommand('EXEC StoredProc(@p1, @p2)'); cmd.CommandType = CommandType.Text; cmd.Parameters.Add('@p1', 1); cmd.Parameters.Add('@p2', 2); 

any worse than

cmd = new SqlCommand('StoredProc'); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add('@p1', 1); cmd.Parameters.Add('@p2', 2); 

EDIT: Fixed bad copy paste job (again). Also, the whole point of the question is for a data access class. I’d much rather be able to pass the stored proc name and parameters in one line as opposed to extra lines for each parameter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:23:34+00:00Added an answer on May 11, 2026 at 10:23 am

    One difference is how message pumping happens.

    Where I used to work we had a number of batch processes that ran over night. Many of them simply involved running a stored procedure. We used to schedule these using sql server jobs, but moved away from it to instead call the procedures from a .Net program. This allowed us to keep all our scheduled tasks in one place, even the ones that had nothing to do with Sql Server.

    It also allowed us to build better logging functionality into the .Net program that calls the procedures, so that the logging from all of the overnight processes was consistent. The stored procedures would use the sql print and raiserror functions, and the .Net program will receive and log those. What we learned was that CommandType.StoredProcedure would always buffer these messages into batches of about 50. The .Net code wouldn’t see any log events until the procedure finished or flushed the buffer, no matter what options you set on the connection or what you did in your sql. CommandType.Text fixed this for us.

    As a side issue, I’d use explicit types with your query parameters. Letting .Net try to infer your parameter types can cause issues in some situations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any benefit in using a <blockquote> element over a <div> ? I
Is there any benefit in using compile for regular expressions in Python? h =
I am working on a new project. Is there any benefit with going with
Is either: <a href=#><h1>text here</h1></a> or <h1><a href=#>text here</a></h1> correct. Is there any benefit
A part from memory usage, is there any benefit using an Int32 on a
Is there any benefit on Windows to use the WSA winsock functions compared to
In asp.net is there any benefit to including or not including an id property?
If you are creating a 1d array in Python, is there any benefit to
I was wondering if there is any concurrency (now or future), or performance benefit
Are there any performance benefits to me not using the gridview in asp.net for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.