Autor Beitrag
biohazard
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89



BeitragVerfasst: Mo 17.11.03 16:32 
Hallo,

ich habe folgendes Problem. Wenn ich diese Anweisung ausführe, sollen alle Datensätze mit einer bestimmten Auftragsnr. von der Tabelle Proben in die Tabelle probencopy kopiert werden. Das macht er ja auch. Komischerweise fügt er aber die doppelte Anzahl an Datensätzen ein.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
begin
tab_copy.Sql.Text :='INSERT INTO probencopy (Auftrags_Nr, Firmen_Nr, Eingangs_Datum,Probennr ) SELECT Auftrags_Nr, Firmen_Nr, Eingangs_Datum, Probennr FROM proben WHERE Auftrags_Nr = 4430';

tab_copy.Active := true;
end;

Hat dafür vieleicht jemand eine Erklärung. Ich komm nicht dahinter was das soll.

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.

_________________
LIVE FAST, DIE YOUNG
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 18.11.03 12:05 
Hab sowas bisher noch net oft gemacht, aber versuch mal das SELECT-Statement erstmal in Klammern zu setzen.
Kommt beim Ausführen des SELECTs alleine denn das richtige raus?
biohazard Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89



BeitragVerfasst: Di 18.11.03 14:00 
Hallo,
hab die Lösung. An der SQL-Anweisung ist nichts falsch.
Ich mußte diese Zeile:
ausblenden Quelltext
1:
tab_copy.Active := true;					

nur in:
ausblenden Quelltext
1:
tab_copy.ExecSql;					

ändern.

Trotzdem Danke das du dir das Thema mal angeschaut hast.

_________________
LIVE FAST, DIE YOUNG