strange behaviour in new component (master detail)

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
ccmcbride
Posts: 101
Joined: Tue 01 May 2007 16:36

Post by ccmcbride » Wed 24 Sep 2008 20:43

I have set it as the very first line of my main form create procedure.
It is not working for me.
I have Master tables with many detail tables.
I have a table open procedure that refreshes the table if it is already open.
As part of this procedure, I check to see if the master source is null, and if not, to compare the values of the linking fields. If they do not match, then display a debug message, and close and reopen the table. I keep getting the message when I add a new record to the master, if the detail table is already open.

So, how can I fix this? Because I don't want to have to keep opening my details, and if I don't, then I show the detail records for the old record in my grids and such.

I have watched the query in dbmonitor, over and over.
It is running a query against the detail table, using the parameter value of the previous master record.
So, my problem still remains.

lifeform
Posts: 22
Joined: Wed 02 Jan 2008 05:34

Post by lifeform » Thu 25 Sep 2008 02:35

how strange...
in my application i don't change any code just added 1 line of refreshParamOnInsert = true

i linked my detail with sql param
where the sql code is like this

Code: Select all

select * from detail where id = :id
just like that.
and this work normally :(

emm but i have one question for the developer
if it's in dbAccess unit then it work for the whole query in the project??
if i just wanna use this old behavior how can it be?
or i must put it in the every form that wanna use old behavior???
please inform me... thx before

ccmcbride
Posts: 101
Joined: Tue 01 May 2007 16:36

Post by ccmcbride » Thu 25 Sep 2008 15:04

I am using tables, with master/detail setup.
Maybe that's the difference, I don't know.
All I know is that the master is in insert mode, and the details are from the previous master, unless I close and reopen the detail table, and I've been chasing this issue all over my code.

lifeform
Posts: 22
Joined: Wed 02 Jan 2008 05:34

Post by lifeform » Thu 25 Sep 2008 15:52

i think it's totally different
if you use table, the records load all to memory (this that i knew)
when you declare master detail with the table, this make linking with something like filter
but if you use query that the detail declared sql with param then
when the master changed the detail will request to the server

so this might be different

and refreshParamOnInsert might means to refresh the sql with parameter to refresh and get the record from the server

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 26 Sep 2008 15:32

lifeform wrote:emm but i have one question for the developer
if it's in dbAccess unit then it work for the whole query in the project??
if i just wanna use this old behavior how can it be?
or i must put it in the every form that wanna use old behavior???
please inform me... thx before
RefreshParamOnInsert is a global variable and therefore if you have set RefreshParamOnInsert to True then this behavior will be used in whole application. You don't need to set RefreshParamOnInsert in every unit.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 26 Sep 2008 15:33

ccmcbride wrote:I have set it as the very first line of my main form create procedure.
It is not working for me.
I have Master tables with many detail tables.
I have a table open procedure that refreshes the table if it is already open.
As part of this procedure, I check to see if the master source is null, and if not, to compare the values of the linking fields. If they do not match, then display a debug message, and close and reopen the table. I keep getting the message when I add a new record to the master, if the detail table is already open.

So, how can I fix this? Because I don't want to have to keep opening my details, and if I don't, then I show the detail records for the old record in my grids and such.

I have watched the query in dbmonitor, over and over.
It is running a query against the detail table, using the parameter value of the previous master record.
So, my problem still remains.
Try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Post Reply