procedure TForm1.DetailsMedia();
var dbFile:
String;
db: TSQLiteDatabase;
tb: TSQLIteTable;
MyLabel: TLabel;
MyMemo: TMemo;
begin
dbFile := ExtractFilePath(ParamStr(0)) + '
Database.db';
db := TSQLiteDatabase.Create(dbFile);
try
// Datensaetze der media Tabelle einlesen
tb :=
db.GetTable('
SELECT media.id_media,'
+ '
media.mediatitle, '
+ '
media.description, '
+ '
media.edition, '
+ '
media.publicationyear, '
+ '
publisher.pubname, '
+ '
media.isbn, '
+ '
place.planame, '
+ '
category.catname, '
+ '
language.langname, '
+ '
entleiher.elastname, '
+ '
entleiher.efirstname, '
+ '
author.aname '
+ '
FROM media '
+ '
LEFT JOIN publisher ON media.fk_publisher_id=publisher.id_publisher '
+ '
LEFT JOIN place ON media.fk_place_id=place.id_place '
+ '
LEFT JOIN category ON media.fk_category_id=category.id_category '
+ '
LEFT JOIN language ON media.fk_language_id=language.id_language '
+ '
LEFT JOIN author ON media.fk_author_id=author.id_author '
+ '
LEFT JOIN entleiher ON media.fk_entleiher_id=entleiher.id_entleiher WHERE id_media='+idinb+'
');
try
// Datensatz anzeigen
if tb.Count > 0
then
begin
// Mediatitle
DetailsMediatitleLabel.Caption := tb.FieldAsString(tb.FieldIndex['
mediatitle']);
// Author
DetailsAuthorLabel.Caption := tb.FieldAsString(tb.FieldIndex['
aname']);
// Description
DetailsDescriptionLabel.Caption := tb.FieldAsString(tb.FieldIndex['
description']);
// Edition
DetailsEditionLabel.Caption := tb.FieldAsString(tb.FieldIndex['
edition']) + '
. Auflage' + '
' + tb.FieldAsString(tb.FieldIndex['
publicationyear']);
// Publisher
DetailsPublisherLabel.Caption := '
Verlag: ' + tb.FieldAsString(tb.FieldIndex['
pubname']);
// ISBN
DetailsISBNLabel.Caption := '
ISBN: ' + tb.FieldAsString(tb.FieldIndex['
isbn']);
// Category
DetailsCategoryLabel.Caption := '
Kategorie: ' + tb.FieldAsString(tb.FieldIndex['
catname']);
// Language
DetailsLanguageLabel.Caption := '
Sprache: ' + tb.FieldAsString(tb.FieldIndex['
langname']);
// Place
DetailsPlaceLabel.Caption := '
Stehplatz: ' + tb.FieldAsString(tb.FieldIndex['
planame']);
// Breiter der Detailansicht anpassen
DetailsDynamWidth();
end;
finally
tb.Free;
end;
finally
db.Free;
end;
end;