Large DataTables and DataGridView component under CF 2.0

  • Thread starter Thread starter Qubeczek
  • Start date Start date
Q

Qubeczek

Hi,
My team is planning to make some software for Mobile Devices under Windows
for Mobile (bussines solutions, based on databases).

The example form should be like this:
- DataGridView component, with some records (eg. 10) - suppose, that table
on serwer has 10 000 records.
- when user scroll - down step-by-step, next records should be downloaded
(not erielr, but just in the moment, when data are needed to show to the
user)
- if user scroll - down next step, the queries for DataTable (or DataView)
are modified that way, that they returns only next couple records.
- if number of records in local buffer exceed some count, the first record
are removed from buffer of DataTable, and next records are downloaded.

The main problem is, that the number of records are NOT KNOWN at the start.
I get records form serwer until I get EOF sign (it dosen;t matter now, what
kind of database it is, suppose, that we get special DataAdapter for .txt
files :-)

What is my problem:
- DataTable is a kind of buffer, that is filled by DataAdapter. I can
udestand that :-) But what to do, when I'd like to constrain the count of
record in this buffer, bud recordset in database is larger than this buffer
?
- how to progam this to using in Datagrid ?

What I need, is to get some Event, that "something" - eg. DataViewGrid -
want to to get "next record after the last one in buffor". And then I could
"download" next part of real recordset.

And I cannot find that Event in any component
DataAdapter-DataBinding-DataTable-DataSet-DataGidView.

Standard DataAdapter.Fill(DataTable) load ALL RECORDS - (eg. 10000) into
DataTable. It's not for me.

I known, that other usually make it's in that way, that they make pagging
style forms, when on every page I have eg. 12 records, and when I click
"Next" new SQL query is generated. I'd like to avoid this.

I have done someting like this, but under VCL (Borland). It was quite
complicated, but posiible. Of course, full source code of VCL was very
helpfull to undestand Borland DataSet logic. Maybe there is a possibility to
get source code of ADO components, just for studying and make concept, how
to ovveride classical components to get my own ? I'd like to use standard
GUI components, but propably I will have to write descendants of ADO.NET
components.

If someone uderstood my message - please help :-)

Regards
Qubeczek
 
There is no DataGridView in NETCF, only a simple DataGrid.



If you're using SQL Mobile as your data base, you can use DataGrid and
SqlCeResultSet classes, it works exactly the way you want.



For other DBs that can be done by creating custom data source class which
implements IBindingSource.

DataGrid would tell you which records it wants via this interface, so you
could go ahead and retrieve them as needed.



Total number of records needs to be reported to the grid and can be queered
by using respective data base means (e.g. COUNT keyword in SQL query).


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).
 
Thanks,
but:
- there are not IBindingSource, maybe you thinks IBindingList ?
- there are a couple of problem with "number of rows must be known "a
priori".
- there is added query for COUNT for every shown
- not for every SELECT statement counting of records by COUNT is possible,
eg. for statements, where GROUP BY is used.

I known, that in this case programer should define View in database.

And about database: I'am planning to use SQL CE, if applications works on
local database, and on Firebird, when aplications works direct on the remote
database (eg. by wireless).

And I have another, basic question: is my idea of working with DataBinding,
DataTables etc, can work in general in wireless environment (i mean speed
of GUI and data transfering) ?

Regards

Qubeczek
 
That's right, IBindingList. I probably was thinking about BindingSource
class which implements IBindingList. :)



Extra query is very little overhead for 10K records.



An estimate number of records would do. This is needed so grid could show
scroll bars correctly.

As soon as you know exact number of records, you can fire list changed event
to inform the grid.

There's a small issue with user scrolling to record which does not exist,
can be solved with providing an empty/default record before it's fixed with
list changed event.



I'd like to point out this idea is not very good one for remote DBs. Speed
will be good, but it requires a live connection and might lock the database.

Also, wireless connection might be unreliable. You probably be better off by
working with SQL CE and synchronizing with another DB from time to time.


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).
 
I'd like to point out this idea is not very good one for remote DBs. Speed
will be good, but it requires a live connection and might lock the
database.

Nobody mentioned live connection. And nobody mentioned, that access will be
direct to the database. I don't know yet, if the on-line connection will be
enoght, but I am ready to implement some buffer software on the server, and
:
- query will be send to the server
- records will be "downloaded" from serwer, when they are need.

This will be like "database driver" - I think, that for MyIBindingList
component a proper instance of DataAdapter class will be connected.

Also, wireless connection might be unreliable. You probably be better off
by working with SQL CE and synchronizing with another DB from time to
time.

this is not possible - HandHeld devices are just different devices for all
ERP system, and synchronizing will make more problems then it's worth.

Can I find anywhere any example, how to implement the IBindingList
descendant component, that it wold work properly with grids ? Which metchods
schould be overriden, etc ...

Or maybe thera are some "inteligent" components accesiblie on thid-party ? I
can not find any thiing like this in the Internet.

Thans for your intrest.

Qubeczek
 
Live connection to the data source is implied in this scenario.

It does not matter if this live connection is to the DB itself or the server
with buffer.

If connection is out, next time user scrolls the grid there's nothing to
display - data is not on device and not accessible.



Replication scenario works best for CRM/ERP type applications.

However, if you're trying to replace existing client with PPC without
changing back end that is indeed not an option.



Since IBindingList is an interface, you have to implement all methods. Some
can just throw, say, NotSupportedException.

For example, if you don't need sorting, RemoveSort() can just throw.



Samples are available on the internet, for example:
http://www.developerfusion.co.uk/show/4490/



I'm not aware of "intelligent" components. They are not very suitable for
semi-connected scenarios and they would be back end specific.


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).
 
Back
Top