Creating a cursor for Dataset/Table

  • Thread starter Thread starter W.G. Rowland
  • Start date Start date
W

W.G. Rowland

Hi, I'm kind of fighting with the task of converting a single user/computer
db app based on DAO/Jet and VB5 to MSDE & VB.Net. Although I love the
concept of the dataset and what all can be done with it, I'm trying to
create some wrapper classes for my table that allow me to both use the
dataset and use some DAOlike features like movefirst, last, next, previous
and so on..

Now, I'd originally figured there'd be some sort of position property on
rows, that might allow me to do this, but that doesn't seem to be the case.
I imagine that's because the queries are filterable/sortable and so on.
Seeing as there's a count property I figured I'd make my own position marker
and then just point my row cursor (a datarow that will contain the info on
whichever row is pointed at) at the appropriate row, but once again, I can't
find any way to select a row by it's position.

So here's how I was contemplating getting around it.

On creation of a table (and again if there's an acceptchanges, rejectchanges
or a change in filter - I hope there are events that can be fired for all
those), I will create a collection containing the row number and the primary
key value for the row. Then on any row changing command I simply increment
the cursor and do a table.rows.find(primary id) using the collection, which
should get me my row (or an error if the row is marked as deleted, in which
case I can bump forward or back to the next valid row depending on the
operation).

My only concerns are (and here's where I hope you can help):

1) Is this a totally brain-dead idea, and if so, what would the
knowledgeable programmer do to get similar results?
2) Are there events for all the conceivable operations that might change the
order/layout of my row/primary ID collection so that I can catch and
recreate the collection when needed?
3) Although I don't imagine there's going to be many situations where the
datatable will have enough rows to really make this a slow operation, how
big a hit do you think this will create?
4) Is there any reason this wouldn't work?

Anyway, any advice is appreciated..

Thanks,
Bill Rowland
 
Kindly disregard most of this as I just realized the item(position) method
of rows was staring me right in the face... I've still got some things to
figure out, but most of this message is now pointless.. D'oh!

Bill Rowland

W.G. Rowland said:
Hi, I'm kind of fighting with the task of converting a single
user/computer
 
Back
Top