// Aufgaben laden
procedure TForm1.LoadJobslistByStart(aFlag: Integer; aListView: TListView);
var
MyItem: TListItem;
n: Integer;
begin
try
aListView.Items.BeginUpdate;
aListView.Clear;
SQLQuery1.Close;
SQLQuery1.SQL.Text := '
SELECT tbmain.id_tbmain, '
+ '
tbmain.number, '
// <------- hier die Problemstelle
+ '
tbmain.title, '
+ '
tbmain.start, '
+ '
tbmain.ende, '
+ '
tbcategory.category, '
+ '
tbprocessowner.processowner, '
+ '
tbpriority.priority, '
+ '
tbstatus.status, '
+ '
tbplace.place '
+ '
FROM tbmain '
+ '
LEFT JOIN tbcategory ON tbmain.fk_category_id=tbcategory.id_tbcategory '
+ '
LEFT JOIN tbprocessowner ON tbmain.fk_processowner_id=tbprocessowner.id_tbprocessowner '
+ '
LEFT JOIN tbpriority ON tbmain.fk_priority_id=tbpriority.id_tbpriority '
+ '
LEFT JOIN tbstatus ON tbmain.fk_status_id=tbstatus.id_tbstatus '
+ '
LEFT JOIN tbplace ON tbmain.fk_place_id=tbplace.id_tbplace WHERE flag = '+ IntToStr(aFlag) +'
';
SQLQuery1.Open;
while not SQLQuery1.Eof
do
begin
MyItem := aListView.Items.Add;
MyItem.Data := Pointer(SQLQuery1.FieldByName('
id_tbmain').AsInteger);
MyItem.Caption := IntToStr(SQLQuery1.FieldByName('
number').AsInteger);
MyItem.SubItems.Add(SQLQuery1.FieldByName('
title').AsString);
MyItem.SubItems.Add(SQLQuery1.FieldByName('
priority').AsString);
MyItem.SubItems.Add(DateToStr(SQLQuery1.FieldByName('
start').AsDateTime));
// Prüfen, ob Datenfeld belegt
if not SQLQuery1.FieldByName('
ende').IsNull
then
MyItem.SubItems.Add(DateToStr(SQLQuery1.FieldByName('
ende').AsDateTime))
else MyItem.SubItems.Add('
');
MyItem.SubItems.Add(SQLQuery1.FieldByName('
place').AsString);
MyItem.SubItems.Add(SQLQuery1.FieldByName('
category').AsString);
MyItem.SubItems.Add(SQLQuery1.FieldByName('
processowner').AsString);
MyItem.SubItems.Add(SQLQuery1.FieldByName('
status').AsString);
SQLQuery1.Next;
end;
aListView.Items.EndUpdate;
except
on E:
Exception do MessageDlg('
Die Aufgaben konnten nicht gelesen werden!'
+ #13 + #13 + E.ClassName + #13 + E.
Message, mtError, [mbOk], 0);
end;
end;