No SQL Connection DataTable usage in LINQPAD
Options
In C# code i have a datatable (no access to actual table or SQl connection) and i would like to generate LINQ using LINQPAD.
Please help.
Thank You
Amit
Please help.
Thank You
Amit
Comments
-
If you want to query a DataTable with LINQ, you need LINQ to DataSet:
http://msdn.microsoft.com/en-us/library/bb386977.aspx
The following example will get you started in LINQPad:
http://share.linqpad.net/h7tahh.linqvar dt = new DataTable (); dt.Columns.Add ("Name", typeof (string)); dt.Rows.Add ("Joe"); dt.Rows.Add ("Mary"); var query = from row in dt.AsEnumerable() where row.Field<string>("Name").StartsWith ("J") select row; query.Dump();
-
Awesome Thanks Alot