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 2: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
0 OriginalGriff 7,130
1 DamithSL 5,089
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,647
4 Kornfeld Eliyahu Peter 4,409


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100