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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:18:40+00:00 2026-06-16T03:18:40+00:00

I am rebuilding this website php/mysql into asp.net. I am working on building the

  • 0

I am rebuilding this website php/mysql into asp.net. I am working on building the main card search form in the header of the page. There is a text input, multiple dropdowns (that all point to different columns) and some conditional search options.

For the mysql version I was able to use conditionals to build a sting containing the query and then execute it.

 //MySql/PHP example
 $query = "SELECT * FROM cards WHERE ";

    //Encounter_set 
if (isset($_GET['Encounter_Set']){
    $query.= "Encounter_Set=:Encounter_Set AND ";
    $queryArray['Encounter_Set'] = $_GET['Encounter_Set'];
}

 //radio statements
switch ($_GET['radio']) {
    case "All":     $query.= "(Title LIKE :terms OR Traits LIKE :terms OR Shadow_Text LIKE :terms OR Text LIKE :terms)";break;
    case "Title":   $query.= "(Title LIKE :terms)";break;
    case "Traits":  $query.= "(Traits LIKE :terms)";break;
    case "Text":    $query.= "(Shadow_Text LIKE :terms OR Text LIKE :terms)"; break;
    default:        $query.= "(Title LIKE :terms OR Traits LIKE :terms OR Shadow_Text LIKE :terms OR Text LIKE :terms)";
}

 //Finally
 $result = $db_con->prepare($query);

How would I go about doing that in LINQ?

  • 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-16T03:18:41+00:00Added an answer on June 16, 2026 at 3:18 am
    using (var context = new MyDbContext())
    {
        IQueryable<Card> query = context.Cards;
        if (!string.IsNullOrEmpty(Encounter_Set))
        {
            query = query.Where(c => c.Encounter_Set == Encounter_Set);
        }
        switch (radio)
        {
            default:
            case "All":
                query = query.Where(c => c.Title.Contains(terms)
                    || c.Traits.Contains(terms)
                    || c.Shadow_Text.Contains(terms)
                    || c.Text.Contains(terms));
                break;
            case "Title":
                query = query.Where(c => c.Title.Contains(terms));
                break;
            case "Traits":
                query = query.Where(c => c.Traits.Contains(terms));
                break;
            case "Text":
                query = query.Where(c => c.Shadow_Text.Contains(terms)
                    || c.Text.Contains(terms));
                break;
        }
        // ...
        return query.ToList(); // Execute the query
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a VS2010 Solution containing an ASP.NET Website Project and 8 c#
Hey. We're building a large ASP.NET website, and have hired an external firm to
When working with asp.net MVC 3, the default website which is installed from the
I am planning to rebuilding the code of one asp.net project to another asp.net
I'm working on rebuilding the UI portion of our website which is all heavily
So I'm currently working on rebuilding an existing website that is used internally at
I have an existing complex website built using ASP.NET MVC, including a database backend,
I have an asp.net MVC project hosting a silverlight application. I just started rebuilding
I'm currently rebuilding one of my ASP.NET [Webform] Sites with JQuery Mobile + MVC
Hi, The login method in my ASP.NET MVC page looks something like this :

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.