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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:46:28+00:00 2026-05-22T17:46:28+00:00

We have an ASP.NET 2.0 application that uses Enterprise Library Data Access Application Block

  • 0

We have an ASP.NET 2.0 application that uses Enterprise Library Data Access Application Block heavily. There is a helper routine which in short accepts an array of parameters for a SP along with the name of the SP and calls that SP. So effectively

  object[] parameters = string.IsNullOrEmpty(paramsString) ? null : jss.Deserialize<object[]>(paramsString);

DbCommand procProcess = Database.GetStoredProcCommand(_storedProc, parameters);

We also have a lot of stored procedures that rely on default values for parameters. Usually these parameters with default values are always at the end of stored proc definition such as

CREATE PROCEDURE MyProc
@param1 int
,@param2 int
,@param3 int = 0
AS
....

I want to be able to call the proc by passing in the values for just param1 and param2. But ofcourse if my parameters has only two params, then this call

DbCommand procProcess = Database.GetStoredProcCommand(_storedProc, parameters);

would still bring back param3 but will not assign it its default value. Hence the call

 procProcess.ExecuteNonQuery();

will fail.

Can anyone help me in either omitting these parameters with default values specified or pass them the SQL equivalent of keyword “default” somehow?

  • 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-22T17:46:29+00:00Added an answer on May 22, 2026 at 5:46 pm

    I solved this myself. Basically I refactored the code to accept either an object array of parameters which then gets passed to the

    DbCommand procProcess = Database.GetStoredProcCommand(_storedProc, parameters);
    

    call or accept a serialized representation of array of a custom class which simply lists param names and their values. The code then deserializes this passed in array of the custom class and does something like

    DbCommand procProcess = Database.GetStoredProcCommand(_storedProc);
    
                        for (int i = 0; i < typedparams.Length; i++)
                            procProcess.Parameters.Add(new SqlParameter(typedparams[i].ParamName.StartsWith("\\@") ? typedparams[i].ParamName : "@" + typedparams[i].ParamName, typedparams[i].ParamValue));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET application that uses the Fluorine FX remoting library. When the
I have an ASP.NET application that uses a custom .NET library (a .DLL file).
I have an asp.net application (relying party) that uses a passive STS for authentication
We have an ASP.NET application running at a customer site that uses ActiveDirectory for
I have a ASP.NET intranet application that has a document library section. The user
I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the
I have an ASP.NET application that uses Session.SessionID to prevent multiple users viewing the
I have an ASP.NET application that uses a layered architecture e.g. presentation layer, business
We have an ASP.NET application that uses Forms Auth. When users log in, a
We have an ASP.NET application that uses the Infragistics WebSchedule control to display appointments

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.