Hier mal ne kurze Procedure um die Tabelle zu füllen:
Delphi-Quellcode:
procedure TFRM_AM_Administration.Button22Click(Sender: TObject);
Var Date : TDate;
i : integer;
ADOQuery : TADOQuery;
begin
ADOQuery := TADOQuery.Create(self);
ADOQuery.Connection := FRM_Main.ReadConnection;
Date := StartOfAYear(2008);
for I := 1 to DaysInYear(Date) do
begin
Listbox5.Items.Add(DateToStr(Date)+ '|'+ IntToStr(WeekOf(Date)));
ADOQuery.sql.text := 'INSERT INTO TB_AM_Calendar (Date, KW) VALUES '+
' (:Date, :KW)';
ADOQuery.Parameters.ParamByName('Date').Value := Date;
ADOQuery.Parameters.ParamByName('KW').Value := WeekOf(Date);
ADOQuery.ExecSQL;
sleep(10);
Date := IncDay(Date,1);
end;
ADOQuery.free;
end;