Dataset requery

P

Peter Van Wilrijk

Hi,

In VB6 I used a method requery to repopulate a recordset. I don't find
an equivalent for the .NET dataset.

I don't update my datasets at all, but I use them to navigate through
subsets of my tables, saying my dataset contains primary keys, ordered
in a specific way. When I go the next, previous, first or last record
in the dataset I execute a select stored procedure. When I do an
insert, delete or update I call a stored procedure, implying I should do
a requery of the dataset (subset) because a row might be deleted or
inserted in the database, while it's not reflected in the disconnected
dataset.

Of course I can execute the query to create the dataset again, after
each insert/delete. I wondered there might be a method dataset.requery
or a workaround to achieve this easily??

Thanks a lot,
Kind regards,
Perre Van Wilrijk.
 
A

AMDRIT

I would requery as normal, and merge the result into the original dataset.
If you use a date modified column in your data, you could query where last
modified is greater than the date that you last polled for changes.
 
P

Peter Van Wilrijk

Thanks AMDRIT,

Do you have a link to an example?

I deduct merging 2 datasets (with the same structure) is easily done ...
as using a "union" in SQL?

Can't I get a problem with this workaround if a row was physically
deleted, the row will stay in the dataset I guess ... but there I see
now I always have to check that since another user might have deleted
the row that I have in my susbset of primary keys.

However, I wondered whether the dataset stores the query it was
originally build on. This way I don't have to store that query (and
it's values in the where clause) myself. Actually that's what I meant
to ask, but I didn't make myself very clear. Sorry, no native English
and just switching from VB6 to VB.NET.

Kind regards,
Perre Van Wilrijk.
 

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

Similar Threads


Top