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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:47:28+00:00 2026-05-20T13:47:28+00:00

Work on C# .I have a dataset I want to search string on this

  • 0

Work on C#.I have a dataset I want to search string on this dataset table.

DataSet ds = new DataSet();
ds = ImportFromExcel(oOpenFileDialog.FileName, false);
...      
var w = (from p in ds.Tables["ReadExcel"].Rows.Cast<DataRow>().ToArray()
         select p.ItemArray).ToList();

string[] sExcelString = {"Vessel Name :", "Voyage No. :", "Port :", "Terminal :",

“NMC Global File :” };

from this w list I want to search sExcelString string arrays all element .After search I want to get the list to retrive the related values.How to search on list and how to get the related list for next process.Bellow picture describe detail.

enter image description here

If have any query plz ask?Thanks in advance.

  • 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-20T13:47:28+00:00Added an answer on May 20, 2026 at 1:47 pm

    The first thing you want to do is re-write your “w” expression like this:

    var w = from p in ds.Tables["ReadExcel"].AsEnumerable() select p.ItemArray;
    

    .ToArray() and .ToList() should be saved as options of last resort — for example if you need to pass the expression to a function that requires an array or if you really want to protect the result against multiple iterations. Calling them too soon forces an iteration of your data, and prevents you from using the nice composition properties of linq to narrow your result first (and thus save big on memory and execution time).

    Once that is done, you can add additional “from” and “where” directives to join the data like so:

    var w = from p in ds.Tables["ReadExcel"].AsEnumerable()
            where p.ItemArray.Intersect(sExcelString).Any()
            select p.ItemArray;
    

    Note that I rarely use the query comprehension syntax; I prefer the function calls/lambda notation. I also typed this right into the browser. Put the two together and it’s unlikely to work “as is”. The important thing here is that this should get you 90% of the way there. Consider the last 10% a chance to really understand how this all works, so that you can better write future expressions.

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

Sidebar

Related Questions

i have a dataset returned by .net webservice and i want to parse this
This question is complicated so examples would work best...I have the following table on
I have a query, like such: var query = from sessions in dataSet where
I have this xml file, and now i will want to add new entries
I have some data I want to work with. Two string and two numbers
I work on a data intensive module. I have a datacolumn inside a dataset
I have a dataset akin to this User Date Value A 2012-01-01 4 A
I have a Dataset and want to display the containing rows in a WPF-Contorl.
I want to split characters. Although I have a large dataframe to work, the
I have data coming from the database in the form of a DataSet .

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.