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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:00:43+00:00 2026-06-04T02:00:43+00:00

I am trying to understand dynamic linq as used by Scott Guthrie in this

  • 0

I am trying to understand dynamic linq as used by Scott Guthrie in this example Dynamic Query

Scott attached a file as an example in the CsharpSamples file where he uses a dynamic query to look in multiple columns for a search. I am trying to understand how a dynamic query works so I may adapt his code to work in my program.

This code snippet below is giving me the most trouble

var query = db.Customers.Where("City == @0 and Orders.Count >= @1", "London", 10).
            OrderBy("CompanyName").
            Select("New(CompanyName as Name, Phone)");

I am not understanding why on the first line he hard codes the value “London and “10”?

I want to use dynamic Query for a search function where the table is called iamp_mapping and the columns I would like to search are called PA, Major Program, Investment_Area, Director and VP.

I want to the user to be able to use a single search box to search every column for the existence of a value. Also here is the search function I would like to use to search for the value. I was able to get it working with a single column search but not with every column.

if (!String.IsNullOrEmpty(searchString))
{
}

I hope that this makes sense, please feel free to ask any questions that would help diagnose my problem. I will be checking back often.

  • 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-04T02:00:45+00:00Added an answer on June 4, 2026 at 2:00 am

    As I understand from your comment, you would like something like this:

    var query = db.iamp_mapping.Where("PA == %0 and Major_Program == %0 and Investment_Area == %0 and Director == @0 and VP == @0", "ValueToSearchFor").
                OrderBy("...").
                Select("...");
    

    Note: I didn’t test it exactly, but from my intuition, I would say this works. Of course you still have to add the OrderBy and Select correctly.

    The @0 is just the first value parameter you give the Where method.

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

Sidebar

Related Questions

I am trying to understand dynamic linq and expression trees. Very basically trying to
How does structure of global offset table(ELF) look. I am trying to understand dynamic
If you are trying to understand dynamic linking, this question is likely to be
I am trying to understand the process of dynamic linking, in detail. For the
Trying to understand PNG format. Consider this PNG Image: The Image is taken from
Trying to understand Ruby a bit better, I ran into this code surfing the
Trying to understand the math of this code snippet. A token is provided which
My first post on this site with huge hope:: I am trying to understand
I'm having some trouble trying to understand how to create a dynamic choice field
I was trying a sample program to understand the behavior of the dynamic GridView

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.