Master/Detail Relatioship Broke
Master/Detail Relatioship Broke
Hi
After upgrading from SDAC 3.70.2.28 to SDAC 5.00.0.1 my Master/Detail relationship is broken. I cannot see any detail records. If I run my app which was complied with the old version everything works fine. Are there any new settings I should be aware when using the latest version od SDAC? All my relations are setup correctly. I have the master dataset as the MasterSourceDataset for the detail dataset. Please help. I have many master/detail relationsships in my app.
Thanks
From
Jigesh
After upgrading from SDAC 3.70.2.28 to SDAC 5.00.0.1 my Master/Detail relationship is broken. I cannot see any detail records. If I run my app which was complied with the old version everything works fine. Are there any new settings I should be aware when using the latest version od SDAC? All my relations are setup correctly. I have the master dataset as the MasterSourceDataset for the detail dataset. Please help. I have many master/detail relationsships in my app.
Thanks
From
Jigesh
-
AndreyZ
Hello,
I couldn't reproduce the problem. I have created a master/detail relationship using SDAC 3.70.2.28 and it correctly works with SDAC 5.00.0.1. Please, try creating a new master/detail relationship using SDAC 5.00.0.1. If it doesn't work then check that you don't have any old dcu files from SDAC 3.70.2.28 in your project. If the problem persists, please post here the piece of code where you are initializing the master/detail relationship.
I couldn't reproduce the problem. I have created a master/detail relationship using SDAC 3.70.2.28 and it correctly works with SDAC 5.00.0.1. Please, try creating a new master/detail relationship using SDAC 5.00.0.1. If it doesn't work then check that you don't have any old dcu files from SDAC 3.70.2.28 in your project. If the problem persists, please post here the piece of code where you are initializing the master/detail relationship.
Jigesh is right. I just discovered that today. To reproduce it is simple:
1- Create a table: Cats (ID, Name) and fill it with some data.
2- Create another table: Products (ID, Name, CatID)
3- Add the two tables to a form and create the necessary master-detail relation ship
4- Add DBEdit components for the Products fields
5- Add DBLabel and link it to Cats.Name
6- Now, when you add a new product and write a CatID that exists in the Cats table, the DBLabel show the name correctly. This behavior is broken in 5.00.0.1.
7- If you save the record and open it again, it will show the category name correctly.
8- Now, the only way to get the correct behavior back is to add an OnExit even to the DBEdit of the Products.CatID where you have to Cats.Close and Cats.Open. Refresh doesn't work.
1- Create a table: Cats (ID, Name) and fill it with some data.
2- Create another table: Products (ID, Name, CatID)
3- Add the two tables to a form and create the necessary master-detail relation ship
4- Add DBEdit components for the Products fields
5- Add DBLabel and link it to Cats.Name
6- Now, when you add a new product and write a CatID that exists in the Cats table, the DBLabel show the name correctly. This behavior is broken in 5.00.0.1.
7- If you save the record and open it again, it will show the category name correctly.
8- Now, the only way to get the correct behavior back is to add an OnExit even to the DBEdit of the Products.CatID where you have to Cats.Close and Cats.Open. Refresh doesn't work.
-
AndreyZ
I'm using the following code to establish master/detail relationship between two tables:
I'm using the following code to add a new record to the detail table (button click):
Are you using the same code? If no, please, correct it so I can reproduce the problem. If yes, specify which component behaves incorrectly?
Also you can compose a small sample to demonstrate the problem and send it to andreyz*devart*com.
Code: Select all
tblMaster.TableName := 'Emp';
tblDetail.TableName := 'Dept';
tblDetail.MasterSource := dsMaster;
tblDetail.MasterFields := 'ID';
tblDetail.DetailFields := 'EmpID';
DBText_EmpName.DataSource := dsMaster;
DBText_EmpName.DataField := 'Name';
DBEdit_DeptID.DataSource := dsDetail;
DBEdit_DeptID.DataField := 'ID';
DBEdit_DeptName.DataSource := dsDetail;
DBEdit_DeptName.DataField := 'Name';
DBEdit_DeptEmpID.DataSource := dsDetail;
DBEdit_DeptEmpID.DataField := 'EmpID';
tblMaster.Open;
tblDetail.Open;Code: Select all
tblDetail.Append;
tblDetail.FieldByName('ID').AsInteger := StrToInt(edNewDeptID.Text);
tblDetail.FieldByName('Name').AsString := edNewDeptName.Text;
tblDetail.FieldByName('EmpID').AsInteger := StrToInt(edNewDeptEmpID.Text);
tblDetail.Post;Also you can compose a small sample to demonstrate the problem and send it to andreyz*devart*com.
-
AndreyZ
Where do I find RefreshParamsOnInsert option. Which dataset is involved.AndreyZ wrote:To solve the problem set the RefreshParamsOnInsert global variable from the DBAccess unit to True. Notice that if you have a lot of master/detail relationships, setting this variable to True may cause performance decreasing.
Thanks
Jigesh
-
AndreyZ
RefreshParamsOnInsert is a global variable from the DBAccess unit. To use it, add DBAccess unit in the uses clauses of your unit and write the following code:
All datasets use this variable for master/detail relationships.
Code: Select all
RefreshParamsOnInsert := True;Hi AndreyZ,AndreyZ wrote:RefreshParamsOnInsert is a global variable from the DBAccess unit. To use it, add DBAccess unit in the uses clauses of your unit and write the following code:All datasets use this variable for master/detail relationships.Code: Select all
RefreshParamsOnInsert := True;
Your suggestion worked very well for me.
Thanks
-
AndreyZ