Subject | Antw: Re: [IBO] 4.2f ibotable master/detail insert and dbnavigatoredit button |
---|---|
Author | Uwe Cramer |
Post date | 2002-02-03T18:00:23Z |
thanks to daniel,
the sample for my 1 question may work, but i think that
the dbnavigator edit button should be disabled if the
connected dataset isempty or not?
for my second question i will test it
uwe
suggest
that you use a Boolean variable to indicate this.
Example of usage:
procedure TButton.OnClick(Sender: TObject);
begin
InsertingRecord := True;
TIBOTable.Insert;
...
your code here
...
InsertingRecord := False;
end;
procedure TIBOTable.OnBeforeInsert(Dataset: TDataset);
begin
if not InsertingRecord then
Abort; {This will abort the Insert process}
end;
problem. Can you check in what sequence your code is executed, by
doing a
debug and using break points?
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)
------------------------ Yahoo! Groups Sponsor
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
the sample for my 1 question may work, but i think that
the dbnavigator edit button should be disabled if the
connected dataset isempty or not?
for my second question i will test it
uwe
>>> drail@... 03.02.2002 17:52:29 >>>Comments below.
>1)Since you're using a regular button to perform your insert, then I
>i have disabled the insert button for the detail dbnavigator and
>give the user one special button with some code to insert new
>records.
>but the edit button in dbnavigator acts also like the insert button
>when the detail is empty and it inserts a new record.
>how can i change this ?
suggest
that you use a Boolean variable to indicate this.
Example of usage:
procedure TButton.OnClick(Sender: TObject);
begin
InsertingRecord := True;
TIBOTable.Insert;
...
your code here
...
InsertingRecord := False;
end;
procedure TIBOTable.OnBeforeInsert(Dataset: TDataset);
begin
if not InsertingRecord then
Abort; {This will abort the Insert process}
end;
>2)I honestly have to say that this is odd. Because, I don't have this
>when i insert the FIRST record in the empty detail and post it, all
>data from the filled fields are lost
>all fields except the key and (reference field to the master table)
>are empty.
>when i edit this record, fill out the fields a second time, and save
>them, all is fine.
>when i then insert more detail records all filled fields are saved
>with the first post.
problem. Can you check in what sequence your code is executed, by
doing a
debug and using break points?
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)
------------------------ Yahoo! Groups Sponsor
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/