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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:05:26+00:00 2026-06-08T21:05:26+00:00

How can I check the results of LINQ query for a specific string value?

  • 0

How can I check the results of LINQ query for a specific string value?

I have the following linq query:

IEnumerable<DataRow> rows = searchParamsTable.AsEnumerable()
                                        .Where(r => r.Field<String>("TABLE") == tableNumbers[i].ToString()
                                        && r.Field<String>("FIELD ") == fieldName[i]);

I want to see if the result of that query contains a string(passed in form a text box) “wildcardSearchString”.

  • 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-08T21:05:27+00:00Added an answer on June 8, 2026 at 9:05 pm
    var searchRows = 
            rows.Where(tr => tr.ItemArray
                .Any(ti => ti.ToString().IndexOf("wildcardSearchString", StringComparison.CurrentCultureIgnoreCase) > 0))
    

    This will go through each of the rows that was returned, and see if “wildcardSearchString” is in the rows item string representation (ignoring case). Here’s the problem though, this won’t get you wildcard search support, so you’ll have to figure that one out yourself. You can try to use Regex, which would require a slight modification:

    string searchPattern = "some*string".Replace("*", ".*");
    var searchRows = 
            rows.Where(tr => tr.ItemArray
                .Any(ti => Regex.IsMatch(ti.ToString(), searchPattern)))
    

    Hope that helps. Just be warned that if they decide to try supplying a Regex pattern than this might really mess up whatever they were searching for, so you just need to be careful of input.

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

Sidebar

Related Questions

If I have a linq query that looks like this, how can I check
How can I check the results of preprocessing? For example, say I have the
I have following query, and I am converting it to LINQ. select acq.ACQPub as
I have a check box list in that user can check or uncheck the
I've found a Perl regexp that can check if a string is UTF-8 (the
How can I check with Linq if a collection does not contain an object.
I have a simple contest sign-up web form. Each contestant can check a box
I have the following macro: %macro export_set_excel(data,tabname); PROC EXPORT DATA= &data. OUTFILE= &results. DBMS=EXCEL
On the following query I get objects as return value (and thus checking for
How can I check how many results is returned from mysql db? Im using

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.