linq to DataTable issues

A

Andy B

Hi...

I have this DataTable: StockContract.Dictionary. I need a linq to DataTable
query that will select all rows where the "Word" column values match the
WordTextBox.Text value. I am running into some problems since the linq query
isn't totally like sql queries. If I wrote the query I am looking for in
sql, it would look like this:

select Word from StockContract.Dictionary where Word = WordTextBox.Text;
I then need to take the results of the query and determine if the value in
WordTextBox.Text is already in the column "Word" somewhere. Is there an
example of this somewhere?
I found this linq to DataTable on a google search, but it makes no sense to
me. Can somebody break it apart?

var query = from c in table.AsEnumerable() select new { Week =
c.Field<string>("Week"), Person = c.Field<string>("Person"), Guess =
c.Field<string>("Guess"), Actual = c.Field<string>("Actual") };
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top