Thema: Delphi Update Database via SQL

Einzelnen Beitrag anzeigen

nanix
(Gast)

n/a Beiträge
 
#3

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:47
Well this is concept code but it should do the trick...but how should it look for SQL?

Delphi-Quellcode:
if item then begin
           
           for i:=0 to 9 do begin
           ABSTable1.Open;
           ABSTable1.Insert; // adds new record into table

           ABSTable1.Fields.FieldByName('FirstName').AsString:='John';
           ABSTable1.Fields.FieldByName('LastName').AsString:='Heyho';
           ABSTable1.Fields.FieldByName('Sallary').AsString:='20.200';
           ABSTable1.Post; // saves newly created record to the table
           ABSTable1.Next;
           end;
           Item:=false;
end;
end
else begin
           for i:=0 to 9 do begin
          
           ABSTable1.Locate('ID',i,[]);
           ABSTable1.Edit; // starts updating of current record

           ABSTable1.Fields.FieldByName('FirstName').AsString:='John';
           ABSTable1.Fields.FieldByName('LastName').AsString:='Heyho';
           ABSTable1.Fields.FieldByName('Sallary').AsString:='20.200';
        
           ABSTable1.Post; // saves newly created record to the table
end;
  Mit Zitat antworten Zitat