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 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  
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  
  Print Answers RSS
0 thatraja 395
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 261
3 kbrandwijk 204
4 CPallini 190
0 OriginalGriff 793
1 Sergey Alexandrovich Kryukov 604
2 Dnyaneshwar@Pune 604
3 Kornfeld Eliyahu Peter 530
4 thatraja 440


Advertise | Privacy | Mobile
Web03 | 2.8.140902.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