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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:19:34+00:00 2026-05-23T07:19:34+00:00

Assume that I have a store procedure in SQL Server with a name sp_GetData1

  • 0

Assume that I have a store procedure in SQL Server with a name sp_GetData1 with params:

@Input1 int
@Input2 string

THis stored procedure will return a datatable. To get datatable from this stored procedure, I use ADO.NET. To execute this stored procedure, we must provide param’name, param’s sqldatatype, & param’ value.

I have a question: We can execute this stored procedure (using ADO.NET) without providing param’s name & param’s sqldatatype? That mean, I only need providing values of parameters in order.

Thanks.

  • 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-05-23T07:19:34+00:00Added an answer on May 23, 2026 at 7:19 am

    One way to safely execute a stored procedure without directly specifying the names, direction and type of parameters is to use SqlCommandBuilder.DeriveParameters.

    This will retrieve the parameters from the server amd create the SQLParameter collection for you. You still need to populate the values on the parameter collection on the command.

    ...I'm assuming  a variable cmd with the command string and connection property set
    SqlCommandBuilder.DeriveParameters(cmd);
    cmd.Parameters[0].Value = input1;
    cmd.Parameters[1].Value = input2;
    

    There is a performance penalty for going to the server but at least you don’t have to worry about sql injection

    The old SQLHelper did this and cached the parameters so it only did it once. Enterprise Library will do the same. Full ORMs also will do similar things for you.

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

Sidebar

Related Questions

I have a SQL Server 2008 database. This database has a stored procedure that
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
We have the following simple Stored Procedure that runs as an overnight SQL server
Assume that I have an appstore. developers submit their application in this store. My
Assume that I have this piece of code: @interface Foo : NSObject { Bar
To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck
I have a MySQL stored procedure that uses a temporary table. Assume that my
I have a stored procedure in an old SQL 2000 database that takes a
Lets assume we have 2 instances of SQL Server. In the first instance I
Let's say that I have a form which runs a stored procedure. This stored

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.