Connecting Tech Pros Worldwide Forums | Help | Site Map

Datagridview with Linq

=?Utf-8?B?VmFuZXNzYQ==?=
Guest
 
Posts: n/a
#1: Dec 11 '07
I want to develop a datagridview allowing column selection and filtering,
like this:

http://www.codeproject.com/KB/grid/GridFilter.aspx

This example is using dataset. My question is if:
a) I use the same way, using dataset
b) I use Linq converting a query to dataset
c) or if would be done just with Linq

The objective is just for queries and not to update to the database. And
Linq would be easy in constructing these queries. So, I would like to use
Linq, but I don't want many performance lost using option b described above.

What would be the best option?

Thank you in advance,
Vanessa

Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Dec 11 '07

re: Datagridview with Linq


Vanessa,

You could use LINQ to DataSets to make it easier to perform your
queries, and then produce a DataView from the results. This might be the
easiest to use in your solution if you are already using data sets.

You won't be able to work with anonymous types, but you could still use
projections on non-anonymous types, but you would have to select the items
into a BindingList<T(or some other collection which implements
IBindingList, so that you could get sort functionality).

I shouldn't say you can't work with anonymous types, but given they are
not meant to be used across methods, you would have an incredibly hard time
doing so (you could technically do it through reflection, but why is beyond
me).

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Vanessa" <Vanessa@discussions.microsoft.comwrote in message
news:C4B4E94B-0940-4F56-BEB8-C73F3181F511@microsoft.com...
Quote:
>I want to develop a datagridview allowing column selection and filtering,
like this:
>
http://www.codeproject.com/KB/grid/GridFilter.aspx
>
This example is using dataset. My question is if:
a) I use the same way, using dataset
b) I use Linq converting a query to dataset
c) or if would be done just with Linq
>
The objective is just for queries and not to update to the database. And
Linq would be easy in constructing these queries. So, I would like to use
Linq, but I don't want many performance lost using option b described
above.
>
What would be the best option?
>
Thank you in advance,
Vanessa

Ignacio Machin \( .NET/ C# MVP \)
Guest
 
Posts: n/a
#3: Dec 11 '07

re: Datagridview with Linq


Hi,

Part of the question is what is your knowledge in each feature?
Most probably you can filter it very easily using a DataView, so maybe a) is
a very easy option.
If you are strong enough on Linq (or want to just practice) you can use it
too. But frankly I would go with the option a)


--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Vanessa" <Vanessa@discussions.microsoft.comwrote in message
news:C4B4E94B-0940-4F56-BEB8-C73F3181F511@microsoft.com...
Quote:
>I want to develop a datagridview allowing column selection and filtering,
like this:
>
http://www.codeproject.com/KB/grid/GridFilter.aspx
>
This example is using dataset. My question is if:
a) I use the same way, using dataset
b) I use Linq converting a query to dataset
c) or if would be done just with Linq
>
The objective is just for queries and not to update to the database. And
Linq would be easy in constructing these queries. So, I would like to use
Linq, but I don't want many performance lost using option b described
above.
>
What would be the best option?
>
Thank you in advance,
Vanessa

Closed Thread