Einzelnen Beitrag anzeigen

manfred_h

Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
 
Delphi XE2 Enterprise
 
#7

Re: Import aus Access >> ThousandSeparator

  Alt 20. Nov 2006, 18:38
Es läuft

wenn's interesiert:

Delphi-Quellcode:
function TextToNumber(const Input: string): Extended;
{Remove all thousands separators from Input string and convert to a floating
point number}

var
  Num: String;
begin
  Result := 0;
  Num := Input;
  if Num = 'then Exit;
  while Pos(ThousandSeparator, Num) > 0 do
   Delete(Num, Pos(ThousandSeparator, Num), 1);
  try
   Result := StrToFloat(Num);
  except

  end;
end;
Delphi-Quellcode:
    DM.DB_Gideons.Connected := True;
    DM.Default_D.Open;

            DecimalSeparator := ',';
            ThousandSeparator := '.';

    frm_main.log_window.Lines.Add('==================history=================');
    if not DM.Camps.Active then DM.Camps.Open;
      try
        DM.ADOT_Default_d_imp.Open;
        DM.ADOT_Default_d_imp.First;
        for i := 0 to DM.ADOT_Default_d_imp.RecordCount -1 do begin
          with DM.Default_D do
          begin
            Insert;
            FieldByName('ID').AsString := DM.ADOT_default_d_imp.FieldByName('ID').AsString;
            FieldByName('C_NR').AsString := DM.Camps.FieldByName('C_NR').AsString;
            FieldByName('U_NR').AsString := DM.Camps.FieldByName('U_NR').AsString;
            FieldByName('ID_AREA').AsString := DM.ADOT_default_d_imp.FieldByName('id_sparte').AsString;
            FieldByName('H_DATE').AsString := DM.ADOT_default_d_imp.FieldByName('datum').AsString;
            FieldByName('H_KIND_SERVICE').AsString := DM.ADOT_default_d_imp.FieldByName('Art_Dienst').AsString;
            //
            H_DONATION := DM.ADOT_default_d_imp.FieldByName('Spende').AsVariant;
            Result := TextToNumber(H_DONATION);
            FieldByName('H_DONATION').AsVariant := Result;
            //
            FieldByName('H_G_SPEAKER').AsString := DM.ADOT_default_d_imp.FieldByName('Gideon_Sprecher').AsString;
            FieldByName('H_C_PERSON').AsString := DM.ADOT_default_d_imp.FieldByName('kontakt_herg_durch').AsString;
            FieldByName('H_NOTE').AsString := DM.ADOT_default_d_imp.FieldByName('Bemerkung').AsString;
            FieldByName('L_UPDATE').AsString := DM.ADOT_default_d_imp.FieldByName('letzte_Aktualisierung').AsString;
            frm_main.log_window.Lines.Add(''+ FieldByName('H_DATE').AsString) ; // Logeintrag
            Post;
            DM.ADOT_Default_D_imp.Next;
          end;
        end;
      finally
    DM.pFIBTrans.Commit;
    end;
Besten Dank mkinzler für deine Hilfe.

Shalom
Manfred
  Mit Zitat antworten Zitat