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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:52:22+00:00 2026-05-18T23:52:22+00:00

I have an ASP.NET MVC Web Application that interacts with a SQL Server 2008

  • 0

I have an ASP.NET MVC Web Application that interacts with a SQL Server 2008 database via Entity Framework 4.0.

On a particular page, i call a stored procedure in order to pull back some results based on selections on the UI.

Now, the UI has around 20 different input selections, ranging from a textbox, dropdown list, checkboxes, etc.

Each of those inputs are “grouped” into logical sections.

Example:

  • Search box : “Foo”
  • Checkbox A1: ticked, Checkbox A2: unticked
  • Dropdown A: option 3 selected
  • Checkbox B1: ticked, Checkbox B2: ticked, Checkbox B3: unticked

So i need to call the SPROC like this:

exec SearchPage_FindResults @SearchQuery = 'Foo', @IncludeA1 = 1, @IncludeA2 = 0, @DropDownSelection = 3, @IncludeB1 = 1, @IncludeB2 = 1, @IncludeB3 = 0

The UI is not too important to this question – just wanted to give some perspective.

Essentially, i’m pulling back results for a search query, filtering these results based on a bunch of (optional) selections a user can filter on.

Now, My questions/queries:

  • What’s the best way to pass these parameters to the stored procedure?
  • Are there any tricks/new ways (e.g SQL Server 2008) to do this? Special “table” parameters/arrays – can we pass through User-Defined-Types? Keep in mind im using Entity Framework 4.0 – but could always use classic ADO.NET for this if required.
  • What about XML? What are the serialization/de-serialization costs here? Is it worth it?
  • How about a parameter for each logical section? Comma-seperated perhaps? Just thinking out loud.

This page is particulary important from a user point of view, and needs to perform really well. The stored procedure is already heavy in logic, so i want to minimize the performance implications – so keep that in mind.

With that said – what is the best approach here?

  • 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-18T23:52:23+00:00Added an answer on May 18, 2026 at 11:52 pm

    By a quick Googling, it looks like Entity Framework doesn’t support them, but you can use Table Valued Parameters in ADO.

    You manage that by defining a table type in your server:

    CREATE TYPE yourTypeName AS TABLE (
        columnName <column type>
        -- more columns if you wish, too
    )
    

    and then use it by making a SqlCommand, and doing this:

    SqlParameter param = command.CreateParameter();
    param.ParameterName = "@something"
    param.SqlDbType = SqlDbType.Structured
    param.Value = // a DataTable which matches your table type, I can stick in code I use if you like
    param.TypeName = "table type name";
    

    And your procedures will look like this:

    CREATE PROCEDURE procName
    @something yourTypeName READONLY
    AS
    BEGIN
    ...
    

    Your SQL queries will then use that parameter as if it were a table, though it’s read-only.

    Performance-wise, I’m not a DBA, and I’m not sure how fast XML is – I gather it’s pretty quick. TVPs though are rather blazingly fast, and even the relatively-simple DataTable method I’ve used runs great. There’s more about TVPs here, and quite a few blog posts out there about SQL and TVPs in general.

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

Sidebar

Related Questions

I have built an ASP.NET MVC web application that uses Entity Framework. To provide
I have an Asp.Net MVC application that works in the vs.net development web server.
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
Assuming I have a ASP.NET MVC 3 application that runs in a web farm
I am writing a web application on Asp.Net MVC 3. Assume that we have
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have an ASP.NET MVC web application that implements a custom membership provider. The
I have an asp.net mvc 2 web application that connects to a WCF web
I have built an ASP.NET mvc web application and it seems that some of
I currently have a ASP.Net MVC web application that needs to upload large files

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.