LINQ to typedDataSet
LINQ to typedDataSet
The generated DataSet by DevArt cannot be used with LINQ? Or is there a way to generated a LINQ-enabled TypedDataSet
You can use LINQ to DataSet with strongly-typed Devart DataSets. Here is a simple example built using this article:
http://msdn.microsoft.com/en-us/library ... S.90).aspx
http://msdn.microsoft.com/en-us/library ... S.90).aspx
Code: Select all
dataSet11.Fill();
DataTable dt = dataSet11.Tables[0];
var q = from d in dt.AsEnumerable()
select new
{
Deptno = d.Field("Deptno"),
Dname = d.Field("Dname")
};
q.ToList();
Yes, you can that way, but whats the pint of having a TypedDataSet if i have to manually typed the column name. This is not control at compile time.
When i meant using LINQ to TypedDataSet i meant something like this.
string connectString =
"AttachDBFileName='C:\ProgramFiles\LINQ Preview\Data\Northwnd.mdf';" +
"Server='.\SQLEXPRESS';Integrated Security=SSPI;enlist=false";
using(Northwind db = new Northwind(connectString)) {
var customers = from c in db.Customers
where c.City == "London"
select c;
foreach(Customer c in customers) {
Console.WriteLine("{0}\t{1}", c.ContactName, c.CompanyName);
I got this from: http://msdn.microsoft.com/en-us/library ... S.80).aspx
I have also tested the generated TypedDataSet, from VS and i can use it with LINQ like the example above
When i meant using LINQ to TypedDataSet i meant something like this.
string connectString =
"AttachDBFileName='C:\ProgramFiles\LINQ Preview\Data\Northwnd.mdf';" +
"Server='.\SQLEXPRESS';Integrated Security=SSPI;enlist=false";
using(Northwind db = new Northwind(connectString)) {
var customers = from c in db.Customers
where c.City == "London"
select c;
foreach(Customer c in customers) {
Console.WriteLine("{0}\t{1}", c.ContactName, c.CompanyName);
I got this from: http://msdn.microsoft.com/en-us/library ... S.80).aspx
I have also tested the generated TypedDataSet, from VS and i can use it with LINQ like the example above