AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi ClientDataset-Datensätze kopieren
Thema durchsuchen
Ansicht
Themen-Optionen

ClientDataset-Datensätze kopieren

Ein Thema von merlin17 · begonnen am 2. Jun 2005 · letzter Beitrag vom 3. Jun 2005
 
jensw_2000
(Gast)

n/a Beiträge
 
#2

Re: ClientDataset-Datensätze kopieren

  Alt 3. Jun 2005, 00:40
Dazu kannst das dir folgenden Codelib Eintrag "verbiegen"

[cl]aktuellen Datensatz kopieren/duplizieren[/cl]

Delphi-Quellcode:
procedure CopyCurrentRecord(Quelltabelle, Zieltabelle : TDataSet);
var
  Data : array of variant;
  aRecord : array of TVarRec;
  i : integer;
  max : integer;
begin

  Quelltabelle.first;

  While not Quelltabelle.eof do
  begin

    max := aDataSet.fields.count -1;
    // set the lenghth of the arecord array to be the same as the number of
    // elements in the data array
    SetLength(arecord,max+1);
    SetLength(data,max+1);

    // set the variant type pointers to the data array
    for i := 0 to max do
    begin
      arecord[i].VType := vtVariant;
      arecord[i].VVariant := @data[i];
    end;

    // Copy the Record to the Array
    for i := 0 to max do
      Data[i] := Quelltabelle.fields[i].value;

    // hier muss ggf noch etwas geschraubt werden, falls du berechnete- bzw. Autoinc Felder verwendest
    Zieltabelle.Appendrecord(aRecord);
    
    // fertig, nächster Datensatz ..
    Quelltabelle.next;

  end; // While

end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz