List Info

Thread: problem about ADOTable+Grid




problem about ADOTable+Grid
country flaguser name
United States
2007-02-05 22:14:50

Hi,
i have a question about master-detail connection using TADOTable & Grid

I put 2 ADOTable in 1 form :
TMaster : Primary Key : TNo
TNo char(10)
TTgl date
TCust char (25)

TDetail : Primary Key : TNo, TUrut
TNo char(10)
TUrut byte
TBarang char(25)
THrg integer
TQty integer
TSubTot integer

TMaster & TDetail connected via MasterSource property of TDetail

each table connected to separate Grid

the Problem occurs on the detail grid. Everytime I enter more than 1
row, detail for the previous row become disappear. But after the
Transaction is saved, all data rows suddenly appear.
eq : I enter 1 row on detail, and then press down key to enter data
for 2nd row on the grid ... then 1st row is disappear. Same thing
happened when I press down once more to enter the 3rd data, so at one
time there is only 1 row appear in the detail grid

what should I do to make all rows always appear when I enter more than
1 row of data ?

thx in advance

__._,_.___
.

__,_._,___
Re: problem about ADOTable+Grid
country flaguser name
United States
2007-02-05 22:42:13

1- Try setting your index to a very basic single
record index on the foreign key field only.

2- Disable filters on your detail table.

It looks like Insert state is causing posted
records to be filtered.

Dave

--- Alex Oentoro < alexssby%40gmail.com">alexssbygmail.com> wrote:

> Hi,
> i have a question about master-detail connection
> using TADOTable & Grid
>;
> I put 2 ADOTable in 1 form :
> TMaster : Primary Key : TNo
> TNo char(10)
> TTgl date
> TCust char (25)
>;
> TDetail : Primary Key : TNo, TUrut
&gt; TNo char(10)
> TUrut byte
> TBarang char(25)
&gt; THrg integer
> TQty integer
> TSubTot integer
>;
> TMaster & TDetail connected via MasterSource
> property of TDetail
>
> each table connected to separate Grid
>;
> the Problem occurs on the detail grid. Everytime I
> enter more than 1
> row, detail for the previous row become disappear.
> But after the
> Transaction is saved, all data rows suddenly appear.
> eq : I enter 1 row on detail, and then press down
>; key to enter data
>; for 2nd row on the grid ... then 1st row is
> disappear. Same thing
&gt; happened when I press down once more to enter the
> 3rd data, so at one
> time there is only 1 row appear in the detail grid
>;
> what should I do to make all rows always appear when
>; I enter more than
>; 1 row of data ?
>
> thx in advance
>

__________________________________________________________
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097

__._,_.___
.

__,_._,___
Re: problem about ADOTable+Grid
country flaguser name
India
2007-02-05 23:34:47

Hi,

When you define a master-detail relationship between two datasets (tables, in your case), the detail dataset is filtered according to relationship field with master dataset. When you create a new record in detail dataset, please check if you are setting the value of this relation field according to current record in Master dataset.

E.g.
OnNewRecord of detail u can mention
TDetail.FindField('TNo').AsString := TMaster.FindField('TNo').AsString;

HTH,
regards,
Vishak
----------------------------------------------------
----- Original Message -----
From: Alex Oentoro
To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
Sent: Tuesday, February 06, 2007 9:44 AM
Subject: [delphi-en] problem about ADOTable&#43;Grid

Hi,
i have a question about master-detail connection using TADOTable & Grid

I put 2 ADOTable in 1 form :
TMaster : Primary Key : TNo
TNo char(10)
TTgl date
TCust char (25)

TDetail : Primary Key : TNo, TUrut
TNo char(10)
TUrut byte
TBarang char(25)
THrg integer
TQty integer
TSubTot integer

TMaster & TDetail connected via MasterSource property of TDetail

each table connected to separate Grid

the Problem occurs on the detail grid. Everytime I enter more than 1
row, detail for the previous row become disappear. But after the
Transaction is saved, all data rows suddenly appear.
eq : I enter 1 row on detail, and then press down key to enter data
for 2nd row on the grid ... then 1st row is disappear. Same thing
happened when I press down once more to enter the 3rd data, so at one
time there is only 1 row appear in the detail grid

what should I do to make all rows always appear when I enter more than
1 row of data ?

thx in advance.


**************** CAUTION - Disclaimer ******************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Agni has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Agni reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Agni e-mail system. ***Agni Software Pvt. Ltd.
******************* End of Disclaimer *********************

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: problem about ADOTable+Grid
country flaguser name
United States
2007-02-05 23:40:59

I've already done it before, but the result still the same

procedure TForm1.TDetailNewRecord(DataSet: TDataSet);
begin
With TDetail do
begin
FieldValues['TNo'] := TMaster.FieldValues['TNo'];
FieldByName('TUrut').AsInteger := RecordCount + 1;
FieldByName('TQty').AsInteger := 0;
FieldByName('THrg').AsInteger := 0;
FieldByName('TSubTot').AsInteger:= 0;
end;
end;

On 2/6/07, Vishak < vishak%40agnisoft.com">vishakagnisoft.com> wrote:
&gt; Hi,
> When you define a master-detail relationship between two datasets (tables, in your case), the detail dataset is filtered according to relationship field with master dataset. When you create a new record in detail dataset, please check if you are setting the value of this relation field according to current record in Master dataset.
>
>; E.g.
>; OnNewRecord of detail u can mention
> TDetail.FindField('TNo').AsString := TMaster.FindField('TNo').AsString;
>
> HTH,
>; regards,
> Vishak
&gt; ----------------------------------------------------
> ----- Original Message -----
&gt; From: Alex Oentoro
> To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
&gt; Sent: Tuesday, February 06, 2007 9:44 AM
> Subject: [delphi-en] problem about ADOTable&#43;Grid
&gt;
>
> Hi,
> i have a question about master-detail connection using TADOTable & Grid
>;
> I put 2 ADOTable in 1 form :
> TMaster : Primary Key : TNo
> TNo char(10)
> TTgl date
>; TCust char (25)
>;
> TDetail : Primary Key : TNo, TUrut
&gt; TNo char(10)
> TUrut byte
>; TBarang char(25)
> THrg integer
> TQty integer
> TSubTot integer
>
> TMaster & TDetail connected via MasterSource property of TDetail
>
> each table connected to separate Grid
>;
> the Problem occurs on the detail grid. Everytime I enter more than 1
> row, detail for the previous row become disappear. But after the
> Transaction is saved, all data rows suddenly appear.
> eq : I enter 1 row on detail, and then press down key to enter data
>; for 2nd row on the grid ... then 1st row is disappear. Same thing
&gt; happened when I press down once more to enter the 3rd data, so at one
> time there is only 1 row appear in the detail grid
>;
> what should I do to make all rows always appear when I enter more than
>; 1 row of data ?
>
> thx in advance.

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )