Hallo Andreas,
habe leider das gleich Problem mit dem hochladen.
Ich habe Dein PDF angeschaut, mein Tagebuch ist wesentlich Einfacher gestrickt gewesen,
bloss mehrere Zeilen für Zeiten und Spalten für Tage.
Dort konnte mann dann die Erforderlichen Daten eingeben, leider hab ich das aber nicht als PDF
nur mal auf Papier bekommen.
Endlich habe ich ein Resultat bei meiner Auswertung. Ich habe auf dem Form2 die Monate angezeigt bekommen.
Weis aber bis jetzt nicht wie ich das gemacht habe.
Code: Alles auswählen
{erstellt die Tabelle Jahr}
[code=sql]SQLQuery2.SQL.text := 'CREATE TABLE IF NOT EXISTS tblJahr (ID INTEGER Primary KEY, Jahr Date)';
SQLQuery2.ExecSQL;
SQLTransaction1.commit;
{erstellt die Tabelle Monat}
Code: Alles auswählen
SQLQuery3.SQL.text := 'CREATE TABLE IF NOT EXISTS tblMonth (ID INTEGER Primary KEY, Monat Date)';
SQLQuery3.ExecSQL;
SQLTransaction1.commit;
{Löscht die Tabelle Jahr}
Code: Alles auswählen
SQLQuery2.SQL.Text:='DROP TABLE IF EXISTS tblJahr';
SQLQuery2.ExecSQL;
SQLTransaction1.commit;
{Erstellt Tabelle Jahr und für diverse Jahre als Einträge hinzu}
Code: Alles auswählen
SQLQuery2.SQL.text := 'CREATE TABLE IF NOT EXISTS tblJahr ( ID INTEGER Primary KEY, Jahr VARCHAR(6))';
SQLQuery2.ExecSQL;
SQLTransaction1.commit;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2010")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2011")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2012")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2013")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2014")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2015")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2016")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2017")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2018")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2019")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2020")';
SQLQuery2.ExecSQL;
SQLQuery2.SQL.text := 'INSERT INTO tblJahr VALUES (NULL, "2009")';
SQLQuery2.ExecSQL;
SQLTransaction1.commit;
{Löscht die Tabelle Monat}
Code: Alles auswählen
SQLQuery3.SQL.Text:='DROP TABLE IF EXISTS tblMonth';
SQLQuery3.ExecSQL;
SQLTransaction1.commit;
{Erstellt Tabelle Monat und für diverse Monate als Einträge hinzu}
SQLQuery3.SQL.text := 'CREATE TABLE IF NOT EXISTS tblMonth (ID INTEGER Primary KEY, Month VARCHAR(25))';
SQLQuery3.ExecSQL;
SQLTransaction1.commit;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Januar")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Februar")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "März")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "April")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Mai")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Juni")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Juli")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "August")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "September")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Oktober")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "November")';
SQLQuery3.ExecSQL;
SQLQuery3.SQL.text := 'INSERT INTO tblMonth VALUES (NULL, "Dezember")';
SQLQuery3.ExecSQL;
SQLTransaction1.commit;
{Testet Datenbank Connection}
SQLite3Connection1.Open;
if SQLite3Connection1.Connected then
StatusBar1.Panels.Add.Text:='Verbindung hergestellt';
Code: Alles auswählen
SQLQuery1.Close;
SQLQuery1.SQL.text:='SELECT * FROM tblDateTime';
SQLQuery1.Open;
SQLQuery2.Close;
SQLQuery2.SQL.text:='SELECT * FROM tblJahr';
SQLQuery2.Open;
SQLQuery3.Close;
SQLQuery3.SQL.text:='SELECT * FROM tblMonth';
SQLQuery3.Open;
SQLQuery1.FileName:='migraenetagebuch.sql3db';
SQLQuery1.SQL.Text:='Select * FROM tblDateTime';
SQLQuery1.Active:=True;
SQLQuery2.FileName:='migraenetagebuch.sql3db';
SQLQuery2.SQL.Text:='Select * FROM tblJahr';
SQLQuery2.Active:=True;
SQLQuery3.FileName:='migraenetagebuch.sql3db';
SQLQuery3.SQL.Text:='Select * FROM tblMonth';
SQLQuery3.Active:=True;
[/code]
Auf Form2 Habe ich dann im OnCreate den Folgenden Code angegeben:
Code: Alles auswählen
SQLQuery1.SQL.text := 'CREATE TABLE IF NOT EXISTS tblMedikamente (ID INTEGER Primary KEY, Medikament VARCHAR(25), Image BLOB)';
SQLQuery1.ExecSQL;
Form1.SQLTransaction1.commit;
{Testet Datenbank Connection}
Form1.SQLite3Connection1.Open;
if Form1.SQLite3Connection1.Connected then
StatusBar1.Panels.Add.Text:='Verbindung hergestellt';
Form2.SQLQuery1.FileName:='migraenetagebuch.sql3db';
Form2.SQLQuery1.SQL.Text:='Select * FROM tblMedikamente';
Form2.SQLQuery1.Active:=True;
Ich habe auch gesucht wo ich bei der Query oder dem SQLTransaction
die Tabelle angeben kann, habe aber leider nicht's gefunden um es dann
mit den Comboboxen und der NavBar zu verbinden.
Ich stehe etwas auf dem Schlauch momentan.
Das mit der defekten dB war so richtig, sie wurde leider immer defekt erstellt,
so konnte keine Verbindung zu Ihr erstellt werden. Nun wie gesagt geht mal etwas.
Ich kann leider in der Form2 auch keine weiteren Elemente einfügen und die
NavBar ist deaktiviert da keine Tabelle verbunden ist. Schwanz Beisser eben.
Anbei also die Datenbank Source wie ich es jetzt mal erstellt habe.
Gruss
Chris.
--------------------------------------------------
ZippyUploader(25.01.2016 15-56-07).txt
--------------------------------------------------
Migraene Tagebuch.rar
http://www66.zippyshare.com/v/QHkgxovN/file.html