Compact framework Datagrid with Datareader

L

LB

Hello,
I'm still learning process here...so sorry if it's a dumb question.
Everywhere I read that a datareader is the fastest way to retreive data when
no update are required.

I did some test using a dataset and loaded a datagrid by setting the
datasource with the dataset returned onto the emulator.

I can see also that for the same SQL, the datareader is faster.

But I can not find a way to populate the datagrid with the datareader. Is it
not possible to do so ?
Can you point me out to some sample code ?

The reason I'm asking is also that in the future, those records will be
retreived via webservices...and we would need to have the best performance
as possible.

Thank you

LBS
 
I

Ilya Tumanov [MS]

You can bind to DataReader in NETCF V2 using BindingSource class as proxy:



BindingSource bs = new BindgingSource();

bs.DataSource = myDataReader;

dataGrid.DataSource = bs;



However, that's unlikely to yield any performance advantages over
DataSet/DataAdapter; I would guess it would significantly slower.



Also, DataReader is a live cursor to the data base, so you can not pass it
via Web Service.



For SQL Mobile (SQL CE 3.0) you can use new SqlCeResultSet class which
supports data binding directly.

It's really fast if bound to DataGrid because only visible rows would be
actually retrieved.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
L

LB

Thank you for your kind answer

Ilya Tumanov said:
You can bind to DataReader in NETCF V2 using BindingSource class as proxy:



BindingSource bs = new BindgingSource();

bs.DataSource = myDataReader;

dataGrid.DataSource = bs;



However, that's unlikely to yield any performance advantages over
DataSet/DataAdapter; I would guess it would significantly slower.



Also, DataReader is a live cursor to the data base, so you can not pass it
via Web Service.



For SQL Mobile (SQL CE 3.0) you can use new SqlCeResultSet class which
supports data binding directly.

It's really fast if bound to DataGrid because only visible rows would be
actually retrieved.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top