DataReader and Master-Detail
- From: Christian Schmidt <none@xxxxxxxx>
- Date: Fri, 01 Sep 2006 16:42:07 +0200
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
.
- Follow-Ups:
- Re: DataReader and Master-Detail
- From: William \(Bill\) Vaughn
- Re: DataReader and Master-Detail
- From: Marina Levit [MVP]
- Re: DataReader and Master-Detail
- Prev by Date: Re: Reverse the Day and Month position in DateTime structure?
- Next by Date: Re: Setting a breakpoint in sql server 2000 stored procedure from VS2005
- Previous by thread: Re: MaxPoolSize - Recommendations
- Next by thread: Re: DataReader and Master-Detail
- Index(es):
Relevant Pages
|