Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
HI all, how to bind values in dataset using Linq to dataset. Need sample code in asp.net.
Posted 26-Feb-09 1:27am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There are really nice samples on MSDN:

LINQ to DataSet Samples[^]

101 C# LINQ Samples[^]
or
101 Visual Basic LINQ Samples[^]

Calin
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

DataSet ds = new DataSet();
ds.Locale = CultureInfo.InvariantCulture;
FillDataSet(ds);
 
DataTable products = ds.Tables["Product"];
 
IEnumerable<DataRow> query =
    from product in products.AsEnumerable()
    select product;
 
Console.WriteLine("Product Names:");
foreach (DataRow p in query)
{
    Console.WriteLine(p.Field<string>("Name"));
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

You'll need to add a reference to
System.Data.DataSetExtensions

Then your DataTable will have an extension method AsEnumerable(). You can use this to then run LINQ queries on the rows. There's an example that shows how to use linq with datasets using C#.
  Permalink  
  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 457
1 OriginalGriff 430
2 Shai Vashdi 240
3 Emre Ataseven 165
4 Peter Leow 146
0 Sergey Alexandrovich Kryukov 8,944
1 OriginalGriff 5,280
2 Peter Leow 3,985
3 Maciej Los 3,535
4 Abhinav S 3,218


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 26 Feb 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid