I am changing to remote db (TxDataSet) and I have a form that dynamically changes master - detail SQL's, this was working with FIB components. For example if I have master SQL as "select ordernumber as Order_Number from salesorders" and detail SQL as "select linecode from saleslines where ordernumber = :Order_Number" and have a datasource linked to master dataset and datasource property of the detail dataset set to master datasource. This works fine and uses the master ordernumber to set the detail ordernumber parameter automaitcally. Now if I close both datasets and change both SQL's to "select invoicenumber as Invoice_Number from salesinvoices" and detail SQL as "select linecode from salesinvlines where invoicenumber = :Invoice_Number"
then open master dataset I get error field "Order_Number" not found. Seems the datasource datalink fieldnames is not being cleared either when dataset is close or SQL is changed.
To workaround it I have added the line below
procedure TBaseXDataset.MasterDisabled(Sender: TObject);
begin
FDataLink.FieldNames := ''; //added this line
if Params.Count = 0 then
CheckBrowseMode;
end;
Anyone have any ideas? is it a bug or am I missing something?
Thanks