#1 2011-12-15 09:06:47

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

bug use fileone

part of Person Class

  TSQLPerson = class(TSQLRecord)
  private
    fFam, fIm, fOt,
    fSex: string;
    fDr: TDateTime;
...
  published
    property Fam: string read fFam write fFam;
    property Im: string read fIm write fIm;
    property Ot: string read fOt write fOt;
    property Sex: String read fSex write fSex;
    property Dr: TDateTime read fDr write fDr;
...
  end;

part of Patients Class

  TSQLPatients = class(TSQLPerson)
  private
    fMO: Integer;
    fFizRazv: string;
    fMass, fRost: Real;
...
  published
    property MO: Integer read fMO write fMO;
    property FizRazv: string read fFizRazv write fFizRazv;
    property Mass: Real read fMass write fMass;
    property Rost: Real read fRost write fRost;
...
  end;

procedure update Medical organization code (MO)

procedure TfrmMain.SetMO;
var
  i: Integer;
  patients: TSQLPatients;
  ids: TIntegerDynArray;
begin
  if TablePatients = nil then Exit;

  patients := TSQLPatients.Create;
  try
    patients.FillPrepare(TablePatients);
    if Database.TransactionBegin(TSQLPatients) then
    try
      Database.BatchStart(TSQLPatients);
      while patients.FillOne do begin
        patients.MO := MOs.ID;
        Database.BatchUpdate(patients);
      end;
      Database.BatchSend(ids);
      Database.Commit;
      ShowNotification('МО успешно обновлено');
    except
      ShowNotification('Ошибка при обновлении');
      Database.RollBack;
    end;
  finally
    FreeAndNil(patients);
  end;
end;

patients.FillOne fill only TSQLPerson date (Fam, Im, Ot, Sex...) and no one TSQLPatients (MO, FizRazv...)

Offline

#2 2011-12-15 09:30:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: bug use fileone

I guess this is because your TablePatients table does not contain TSQLPatients fields.

Offline

#3 2011-12-15 11:15:21

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

Re: bug use fileone

ups, you absolutly right

Offline

Board footer

Powered by FluxBB