From: Tom Nowak on 2 Jul 2010 09:36
Trying to develop an asp.net. I want to use a data reader to read a list of
categories from a table. I then want to use another data reader to read
another table and give me a count of records that include the category found
in the first data reader. I want to do this for every category found in the
first data reader.
Any ideas? Please help.
From: Mr. Arnold on 2 Jul 2010 14:00
Tom Nowak wrote:
> Trying to develop an asp.net. I want to use a data reader to read a list of
> categories from a table. I then want to use another data reader to read
> another table and give me a count of records that include the category found
> in the first data reader. I want to do this for every category found in the
> first data reader.
> Any ideas? Please help.
Why don't you just use LINQ to query the tables? By using a foreach loop
after you query for data in the first table using LINQ, you can walk the
results in a foreach loop and query the second table using LINQ.
What is Language Integrated Query?
LINQ is a Microsoft .NET Framework component that adds native data
querying capabilities to .NET languages.
Microsoft LINQ defines a set of query operators that can be used to
query, project and filter data in arrays, enumerable classes, XML,
relational database, and third party data sources. While it allows any
data source to be queried, it requires that the data be encapsulated as
objects. So, if the data source does not natively store data as objects,
the data must be mapped to the object domain. Queries written using the
query operators are executed either by the LINQ query processing engine
or, via an extension mechanism, handed over to LINQ providers which
either implement a separate query processing engine or translate to a
different format to be executed on a separate data store (such as on a
database server as SQL queries). The results of a query are returned as
a collection of in-memory objects that can be enumerated using a
standard iterator function such as C#'s foreach.
Many of the concepts that LINQ has introduced were originally tested in
Microsoft's Cω research project. LINQ was released as a part of .NET
Framework 3.5 on November 19, 2007.
Prev: I got an error
Next: Does anyone know why this news group is not reachable