C
Christian Schmidt
Hi all,
I need to work through a master and its details table. My first attempt
was to open a DataReader on the master and for each record get a new
DataReader on the detail, restricted to the foreign key. But this is
very slow. As the tables are very large I cannot use DataSet's
functionality.
So my idea was to use a stored procedure for the detail reader that
returns details in the same order as the master.
1) Can this be done with a stored procedure? How?
2) Is there a better way?
Thanks for any advice,
Christian
details.read();
while (master.Read()) {
int key = master.GetInt32(masterPrimaryKeyCol);
while (details.GetInt32(detailForeignKeyCol) == key) {
// process details
// ...
details.read();
} // while details
} // while master
I need to work through a master and its details table. My first attempt
was to open a DataReader on the master and for each record get a new
DataReader on the detail, restricted to the foreign key. But this is
very slow. As the tables are very large I cannot use DataSet's
functionality.
So my idea was to use a stored procedure for the detail reader that
returns details in the same order as the master.
1) Can this be done with a stored procedure? How?
2) Is there a better way?
Thanks for any advice,
Christian
details.read();
while (master.Read()) {
int key = master.GetInt32(masterPrimaryKeyCol);
while (details.GetInt32(detailForeignKeyCol) == key) {
// process details
// ...
details.read();
} // while details
} // while master