Dataset to hold all rows or datareader to select current row

  • Thread starter Thread starter Michael Hamrah
  • Start date Start date
M

Michael Hamrah

I need to make design choice whether or not to use a dataset to pull a table
and two subtables into a form which has a main grid, a sub grid, and some
editable textboxes. Or I could use a dataset to fill in just the main grid
and during a rowchanged event fill in the sub grid and textboxes. Of
course, using a dataset for everything would be easier, but what is the
performance cost if I'm returning a hundred rows? A thousand? What
arguments are there for using the dataset for everything vs. a dataset for
the master grid and individual select statements on a primary key to
retrieve just the current row?

Thanks in advance,

Mike
 
it depends on how many max rows in child tables you will get when you change
your row in mastergrid. how fast it retrieve single/multiple rows. and
depends how you are going to provide update to database. question, you want
user to be able to update multiple rows of master table at once. or he can
go record by record. I would prefer to retrieve child tables when I change
row on master table.


Rajesh Patel
 
I'm with Rajesh. A properly indexed query should return a reasonably sized
rowset (a dozen rows) in less than a quarter of a second--especially if
you're executing a stored procedure. Populate the master table with those
rows that pertain to the current business scope (just customers from a
specific zip code, just assemblies from a particular sub-component...) and
when you arrive at a row, populate the child rows and grandchildren if
necessary.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
But what if I wanted to make use of child grid databinding properties? If I
have a parent grid, a child grid, and some child text boxes, every time I
switch a row in my main grid all other fields will automatically update with
the current information. The user can make any edits, switch rows, etc...,
then post changes back to the database with a single update. Wouldn't an
in-memory dataset, (let's say it's twenty rows of ten columns with a child
table of a hundred rows) be better than firing off statements to the
database after every row change (not to mention the logic of updates)?

Thanks,

Mike
 
I would post changes in the context of a single master row. For example, if
the master table held customers and the children kept orders and items, when
the client changes a master customer row or related childrows, I would post
these changes to the DataSet and its collection of Tables, but not to the
database until another master row was selected. Again, an update should take
less than a second and the exception handling needs to be handled while the
client is thinking about the master row--not 10 minutes later when they are
ready to shut the app down.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top