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 8517341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:40:20+00:00 2026-06-11T05:40:20+00:00

Possible Duplicate: SQL Server & .net support calling a stored procedure with param's values

  • 0

Possible Duplicate:
SQL Server & .net support calling a stored procedure with param's values wihout providing param's names?

I want to call a command.ExecuteReader() of type Stored Procedure, however I do not want the parameter names that I pass to be identical to the ones in the SP. Below is a sample of what I’m trying to do

SP:

ALTER PROCEDURE SPName
@Id nvarchar(50)
AS
BEGIN
    SET NOCOUNT ON;
SELECT * FROM TableName
WHERE ColumnName = @Id 
END
GO

Code:

using (SqlCommand command = new SqlCommand(spName, connection) { CommandType = CommandType.StoredProcedure })
{
    command.parameters.Add(new SqlParameter(*paramaeter name*, sqlDbType.nvarchar){ Value = "SomeValue"};
}
  • 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. Editorial Team
    Editorial Team
    2026-06-11T05:40:23+00:00Added an answer on June 11, 2026 at 5:40 am

    Simple fact – you ultimately have to use the correct parameter name when calling a stored procedure because SQL server binds parameters by name (even when you use EXEC to call an SP without using named parameters, the parser binds them by name from left to right).

    So if you want to use a different name you will need to introduce an intermediate layer between your SqlCommand and the target SP.

    But if you just want to not care about the name and have it automatically discovered – then you can use the technique mentioned by Conrad Frix in his accepted answer on SQL Server & .net support calling a stored procedure with param's values wihout providing param's names? – which is why I’ve marked as a duplicate, because it is ultimately what you want to do, even if the reasons are different.

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

Sidebar

Related Questions

Possible Duplicate: SQL Server Full text Index SQL Server stored procedure parameter output I
Possible Duplicate: dynamic sql pivot in sql server How to alter this stored procedure
Possible Duplicate: SQL Server UDF refresh The system stored procedure sp_refreshview can be used
Possible Duplicate: Scheduled run of stored procedure on SQL server I have a stored
Possible Duplicate: Concatenate row values T-SQL I'm new to SQL Server and had tried
Possible Duplicate: Is there a Max function in SQL Server that takes two values
Possible Duplicate: Visual Studio 2005 doesn't support Sql Server 2008 I've got an issue
Possible Duplicate: SQL Server: How do you return the column names from a table?
Possible Duplicate: Lucene.Net and SQL Server I need to storage and index files, like
Possible Duplicate: sql runs fast in ssms slow in asp.net Using SQL Server 2005,

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.