Other Issues

[Previous] [Next]

There are other issues as well with hierarchical recordsets. For example, when you reconnect your hierarchical recordset to the database, only the parent is reconnected. You must reconnect the child recordsets separately. When updating a hierarchical recordset, you must also update parent and child levels separately. Furthermore, you must make sure that parent and children are updated in the correct order. Just let us mention two reasons for this:

  • If you insert a new parent record in the database, you must insert it before you insert any children in it. If you use a so-called synthetic key, which is an ID number that's just a key and doesn't carry any information, you must see to it that all the child records are inserted with the correct value of this key as a foreign key in the parent.
  • If you delete a parent record, you might have to reverse the order, especially if a foreign key protects the rows of the parent table. In such a case, you might have to delete all the connected rows in the child table before you issue the delete command to the parent table. It all depends on your business rules.

As if this isn't enough, you shouldn't expect the ADO recordset UpdateBatch method to work at all for child recordsets, only for the parents; you can read more about this issue and what to do about it in Chapter 23, "Some Final Issues." Even worse: a specific hierarchical recordset might work as you'd expect when accessed within a process; the same recordset might not work when accessed across processes. Note that with MTS and COM+, clients normally call server objects across processes or even across computers. Therefore, an in-process test run isn't conclusive if your production environment is cross-process; if you believe it is, you're liable to get burned. To be safe, you should always test cross-process calls cross-process, just as you should test in-process calls in-process.



Designing for scalability with Microsoft Windows DNA
Designing for Scalability with Microsoft Windows DNA (DV-MPS Designing)
ISBN: 0735609683
EAN: 2147483647
Year: 2000
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net