reload only changes in dataset

  • Thread starter Thread starter Peter Proost
  • Start date Start date
P

Peter Proost

Hello group,

what would be the best way to do the next thing: I've got a grid form with
about 15000 records, when I double click a row a detail form is opened and
the user can modify and save the record, this all works just fine, then the
user closes the detail form and ofcourse I want to show his modifications in
the grid form, but now my question is what's the best way to do this without
completely reloading the dataset that holds the records showed in the
datagrid, is there a way to only reload the changed/new rows. The other
problem is there could be 10 or so users who have the program open so also
their modifications should be visible.

Thanks for any tips or help

Greetz Peter
 
Peter,

What I write here is only valid when you don't use the autoincrement primary
key however us a GUID as primarykey.

First when you have without any error updated a database with your last
changes, what data you want to have changed in your datagrid, are the
updates not the last changes. The datagrid should than show how *those*
datarows are now in the database?

A way to write this, where I don't write in this sample the absolute needed
errorhandling
\\\
if ds.haschanges
da.update(ds.getchanges)
ds.acceptchanges 'this is important here because the getchanges create a
copy dataset
end if
///

I took some time to write the text right. Because it is than not necessary
that the Dataset does reflects the Database. New records added, updates or
deletes by other users are not in that dataset as long as you don't do an
update for those rows. This should, when you did it well, throw an error
when you update your datarows and will never be with a new by others added
one.

You are working with a disconnected dataset, there is not any refreshment
when you don't do it.
I have seen solutions in these newsgroups for when that is necessary (And
that is than with huge datasets). Adding a timestamp, reading those before
the moment of an update can give a solution, however that I never did or
tried.

This is the behaviours from the disconnected dataset, for which a theory is,
that this in most situations will seldom happen. You see me probably often
writting in these newsgroups to keep the datasets as small as possible. Here
you have my main reason for those small datasets.

For more information from others beside in this newsgroup, I advice you to
put this question as well in the newsgroup
microsoft.public.dotnet.framework.adonet

It is often asked, however I don't tell you to search in those messages,
because this is a subject what I never saw really direct nice explained or
where a good link for information was given.

I hope I succeeded a little bit in explaining, however keep in mind that
this is a newsgroup message, so what I write can be understanded wrong by
you or been by me and should only be taken (as forever) as hints to help you
to find the right solutions.

I hope it helps anyway something.

Cor
 
Hi Cor,

first thanks for your explanation, I think I get what you mean, but the
problem said:
A way to write this, where I don't write in this sample the absolute needed
errorhandling
\\\
if ds.haschanges
da.update(ds.getchanges)
ds.acceptchanges 'this is important here because the getchanges create a
copy dataset
end if
///

But my ds has no changes because it's on the grid form and I don't use it
for the updates/inserts, the updates and inserts happen on an other form
where an insert or update command get's generated and executed and then when
the user closes his update/insert form I would like to refresh the dataset
on the grid form so that only the changes made to the database get refreshed
in the dataset and the other records stay unchanged (not reloaded), but from
what I understand from your explanation this isn't possible?

Greetz and thanks again Peter
 
Peter,

Your problem will forever be the deletes or you should create a very special
routine around that. Which depends than how long it takes to completly to
do a new fill from that dataset and that depends than again what database
server you are using.

Just my thought,

Cor
 
Cor,

Just for your information, I'm using a SQL Server. But I guess I've got some
analyzing to do, because here at work we use our own framework (grid/detail
forms and so on), so maybe it's time for a new control with the grid and
detail fields on the same form. But the reason why I asked this question is
because a collegue of mine has a program on citrix with in one grid about
15.000-20.000 records and users notice that after about 30 times of opening
a detail form from the grid, change something, close the detail form, open
an other rercord from the grind an so on. The datagrid gets filled slower
and slower.

Greetz Peter and thanks again
 

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

Back
Top