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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Maybe this: setlocale(LC_COLLATE, 'fr_FR.Latin1', 'fr.Latin1', 'fr_FR.Latin-1', 'fr.Latin-1'); strcmp() and strcasecmp()… May 11, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer The problem is that IIS only invokes ASP .Net for… May 11, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer A window in Windows by definition has only one default… May 11, 2026 at 8:51 pm

Related Questions

In the early days of C++ when it was bolted on top of C,
Best Practices for Speeing Up Your Web Site from Yahoo includes the following recommendation:
This question was suggested by Kyralessa in the What is your most useful sql
There are a number of questions on this site related to how to access

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.