Tom said:
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.
http://en.wikipedia.org/wiki/Language_Integrated_Query
<
http://dotnetarchitect.wordpress.com/2009/03/18/using-linq-to-manipulate-data-in-datasetdatatable/>
<
http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx>