master-detail problem when masterfield is empty persists

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

master-detail problem when masterfield is empty persists

Post by luis_augusto » Fri 14 Oct 2005 13:58

I was looking forward for this new version (3.55.19) because of the problem with the master-detail relationship, when master field is null. I reported this problem imediately after the 3.55.18 release and I was oriented to wait for the next version. I am very frustrated because everytime I try to move forward with this component set I find a critical error which impeeds me to keep going.
The 7th problem reported fixed in the announcement persists. I would like to know if I will have to wait another 40 days for the resolution. :?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 17 Oct 2005 09:56

We have analyzed problem more detailed. This error happens only when user tries to compare Null parameter with NOT NULL field. Unfortunately, Microsoft doesn't provide solution for this problem.

To solve this problem you can open Master table first, or declare MasterId field in Detail table as nullable.

> The 7th problem reported fixed in the announcement persists.

This fix doesn't concern your problem. It fixes problem with DataSet.OnNewRecord event handler.

luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

Problem With null masterfield

Post by luis_augusto » Mon 17 Oct 2005 12:08

Even whether I open the mastertable first, the error will occur due some filter condition applied on it, which could lead to an empty dataset (zero records retrieved).
This is a very common situation which I can't believe was never reported.
You could try, at least, to bypass this problem in the SetMasterparams procedure, as shown bellow.

It may not be a clever solution, neither solves the need to open the mastertable first, but at least solve the problem with empty mastertables.

I don't wish to modify the SDAC source code, so I ask for you to think about some way to bypass this critical problem and release another version as soon as possible.

Thank you.

Luis Mattos

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 18 Oct 2005 14:05

> It may not be a clever solution

It is an unacceptable solution if Null is possible as the value of MasterId. We can't change this behavior for compatibility reason.

As solution, declare MasterId field in Detail table as nullable.

luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

Post by luis_augusto » Tue 18 Oct 2005 16:54

I've suspected that was not a good solution. It was proposed only to make you understand the urgency of the matter. I did not purchase a license of your product to have to change it. Since you are the creator of it, I expect and believe that you are able to provide the best solution for a problem I think to be critical. Unnaceptable would be not having a solution for it.
Anyway, thank you for the suggestion. I will try it, hoping it works.

luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

Problem With null masterfield

Post by luis_augusto » Wed 19 Oct 2005 12:04

The solution you proposed works, except when the detail keyfield is an identity field (not nullable).
It is common to stablish a master-detail relationship between item orders (as master) and orders (as detail), for instance.

I don´t know if it is possible, but you could (at least give the option to) avoid to perform the detail sql sentece when you had not a master record (empty master table recordset). In this case would be necessary just clearing the detail record set.
I am not aware of all the compability issues to MSSQL, but it will certainly increase the level of compatibilty with the Paradox-based legacy.

Thanks again.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 20 Oct 2005 11:27

Your situation seems rather complicated. To help solve this problem you can send us (sdac*crlab*com) a complete small sample to demonstrate it and include script to create and fill tables.
We'll take a closer look at the circumstances.

Post Reply