Nabend.
Ich habe drei Probleme. Zumindest was AutoIt betrifft. Und dann noch eine kleine Fragen.
Und ich hoffe dieses mal ohne
1.)
Ich möchte die Daten nicht in die Console ausgeben, sondern in dem ListView.
2.)
Ich habe unter dem ListView kleine Buttons erstellt. Klicht man da z. B. auf: "Sortieren nach [Titel]", soll nach Gleichem sortiert werden.
3.)
; In der GUI ist [Lfd.-Nr:] und dahinter soll im Gegensatz zur ID eine immer fortlaufende Nummer generiert werden. Sobald ein Datensatz dazu kommt
; [+1], wird ein Datensatz gelöscht soll der Wert NICHT gemindert werden !!! Der dort stehende Wert darf nicht veränderbar durch den User sein.
Also Hilfe und SuFu (in den D & UK) erfolglos genutzt. *schniefel*
Frage:
Wenn ich die ISB Nummer, in Folge ISBN genannt, welche ja auch eine eindeutige Kennung ist, mit einem KEY versehe, worauf muss ich da besonders achten?
Möchte später das Script noch erweitern und dazu wäre die ISBN gut zu gebrauchen.
Datensätze werden im Script zugefügt.
;#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
;Opt
Opt("GUIOnEventMode", 1)
;GUI Titel
$Buchverwaltung = GUICreate("Buchverwaltung erstellt mit AutoIt", 1121, 629, 280, 183)
; Titel oben Mitte
$Label1 = GUICtrlCreateLabel("~ ~ ~ B U C H V E R W A L T U N G ~ ~ ~", 304, 8, 516, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x0000FF)
; ListView
$listview = GUICtrlCreateListView("ID|Titel|Autor|Verlag|E-Datum|Genre|Preis|Einband|ISBN|Seiten|Lager|Serie|Bestellt|Gelesen|Note|Zusatz|Information", 10,40,1105,168)
$List1 = GUICtrlCreateList("", 8, 40, 1105, 168)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
; Hauptbereich
$Label2 = GUICtrlCreateLabel("Titel: ", 10, 274, 45, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input1 = GUICtrlCreateInput("", 160, 272, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Autor:", 10, 305, 45, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input2 = GUICtrlCreateInput("", 160, 302, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label4 = GUICtrlCreateLabel("Verlag: ", 10, 335, 58, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input3 = GUICtrlCreateInput("", 160, 332, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label5 = GUICtrlCreateLabel("Genre: ", 10, 365, 55, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input4 = GUICtrlCreateInput("", 160, 362, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Erscheinungsdatum: ", 10, 395, 149, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input5 = GUICtrlCreateInput("YYYYMMDD", 160, 392, 100, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label7 = GUICtrlCreateLabel("Serie: ", 267, 395, 50, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input6 = GUICtrlCreateInput("", 313, 392, 208, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label8 = GUICtrlCreateLabel("Preis: ", 10, 424, 146, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input7 = GUICtrlCreateInput("", 160, 422, 81, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label9 = GUICtrlCreateLabel("Lagerplatz: ", 267, 424, 85, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input8 = GUICtrlCreateInput("", 354, 422, 165, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label10 = GUICtrlCreateLabel("Einband: ", 10, 455, 70, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input9 = GUICtrlCreateInput("", 160, 452, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label11 = GUICtrlCreateLabel("ISBN", 10, 485, 40, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input10 = GUICtrlCreateInput("", 160, 482, 361, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label12 = GUICtrlCreateLabel("Seiten: ", 10, 514, 57, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input11 = GUICtrlCreateInput("", 160, 512, 81, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label13 = GUICtrlCreateLabel("ausgeliehen an: ", 624, 272, 117, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input12 = GUICtrlCreateInput("", 760, 272, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label14 = GUICtrlCreateLabel("ausgeliehen am: ", 624, 302, 122, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input13 = GUICtrlCreateInput("", 760, 302, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label15 = GUICtrlCreateLabel("ausgeliehen bis: ", 624, 332, 121, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input14 = GUICtrlCreateInput("", 760, 334, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label16 = GUICtrlCreateLabel("Bestellt: J/N", 624, 384, 86, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input15 = GUICtrlCreateInput("", 760, 384, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label17 = GUICtrlCreateLabel("gelesen: J/N", 624, 414, 90, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input16 = GUICtrlCreateInput("", 760, 414, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label18 = GUICtrlCreateLabel("Note: 1 - 6", 624, 444, 76, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input17 = GUICtrlCreateInput("", 760, 444, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label19 = GUICtrlCreateLabel("Zusatz:", 624, 474, 53, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input18 = GUICtrlCreateInput("", 760, 472, 121, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label20 = GUICtrlCreateLabel("Information:", 896, 384, 84, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Edit1 = GUICtrlCreateEdit("", 896, 408, 217, 89)
; Sortierbereich
$Label21 = GUICtrlCreateLabel("Sortieren nach: ", 10, 228, 113, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Alle", 145, 224, 51, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Titel", 201, 224, 41, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Autor", 245, 224, 51, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button4 = GUICtrlCreateButton("Verlag", 301, 224, 59, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button5 = GUICtrlCreateButton("E-Datum", 365, 224, 75, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button6 = GUICtrlCreateButton("Genre", 445, 224, 59, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button7 = GUICtrlCreateButton("Preis", 509, 224, 59, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button8 = GUICtrlCreateButton("Einband", 573, 224, 75, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button9 = GUICtrlCreateButton("ISBN", 653, 224, 51, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button10 = GUICtrlCreateButton("Seiten", 709, 224, 59, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button11 = GUICtrlCreateButton("Lagerplatz", 773, 224, 91, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button12 = GUICtrlCreateButton("Serie", 869, 224, 51, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button13 = GUICtrlCreateButton("Bestellt", 925, 224, 67, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button14 = GUICtrlCreateButton("Gelesen", 997, 224, 67, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Button15 = GUICtrlCreateButton("Note", 1069, 224, 43, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label22 = GUICtrlCreateLabel("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", 8, 256, 1105, 17)
$Label23 = GUICtrlCreateLabel("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", 8, 544, 1105, 17)
$Button16 = GUICtrlCreateButton("S U C H E N", 621, 509, 132, 25)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input19 = GUICtrlCreateInput("Suchbegriff hier eingeben", 760, 507, 347, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label24 = GUICtrlCreateLabel("Lfd.-Nr:", 350, 515, 55, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input20 = GUICtrlCreateInput("", 415, 512, 105, 26)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
GUICtrlSetData(-1, "000002")
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
; unterer Bereich
$Label26 = GUICtrlCreateLabel("Büchermenge: ", 13, 595, 113, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input22 = GUICtrlCreateInput("", 128, 592, 81, 26) ; hier soll die ges. Bücheranzahl eingefügt werden und nicht veränderbar durch Anwender
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label27 = GUICtrlCreateLabel("Ges. Seitenzahl:", 270, 596, 117, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Input23 = GUICtrlCreateInput(" ", 394, 592, 81, 26) ; hier soll die ges. Seitenzahl eingefügt werden und nicht veränderbar durch Anwender
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label28 = GUICtrlCreateLabel("Ges. Buch NP:", 572, 595, 106, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
GUICtrlCreateInput("", 680, 592, 121, 26) ; hier soll der ges. Bücherwert eingefügt werden und nicht veränderbar durch Anwender
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
; Ausleihbutton
$Button17 = GUICtrlCreateButton("Ausleihen", 888, 272, 227, 25)
; DK 1 / 2 / 3
$Button18 = GUICtrlCreateButton("DK 1 / 2 / 3", 894, 334, 99, 26)
; D 1 / 2
$Button19 = GUICtrlCreateButton("D 1 / 2", 1012, 334, 99, 25)
; GUI anzeigen
GUISetState(@SW_SHOW)
; !!! Datei lösche ich hier nur, damit ich sie nicht manuell löschen muss in der Übungsphase !!!
FileDelete(@ScriptDir & "\buchverwaltung.db")
; DLL Pfad
_SQLite_Startup(@ScriptDir & "\sqlite3.dll", False, 1) ; BugFix Idee, da DLL ja nicht mehr mitgeliefert wird
; gibt die SQL Version in die Console aus
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
; Datenbank öffnen, ggf. erstellen
Global $g_db_Database = _SQLite_Open(@ScriptDir & "\buchverwaltung.db")
; Datenbanktabelle
_SQLite_Exec($g_db_Database, "CREATE TABLE IF NOT EXISTS Buchverwaltung(D INTEGER PRIMARY KEY AUTOINCREMENT,Titel,Autor,Verlag,Genre,Erscheinungsdatum,Serie,Preis,Lagerplatz,Einband,ISBN,Seiten,Ausgeliehen_an,Ausgeliehen_am,Ausgeliehen_bis,Bestellt,Gelesen,Note,Zusatz,Information);")
; jeweils ein Datensatz wird dazu geschrieben, Daten sind von Enno Jüders zur Verfügung gestellt.
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('1','13 Tage','Giambanco, Valentina','Droemer Knaur','03.03.2014','Thriller','14.99','Hardcover','9783426513996','576','','..','..','R1-F2','','','N','','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('2','Abgründe','Strobel, Arno','Loewe','10.03.2014','Thriller-J','9.95','Taschenbuch','9783785578643','240','','..','..','R1-F2','','','N','','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('3','Agent 6','Smith, Tom Rob','Goldmann','14.09.2011','Thriller','9.99','Taschenbuch','9783442546770','540','','..','..','R1-F2','Leo Demidow Bd.3','','N','','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('4','Bedroht','Koppen, Hans','Heyne','27.03.2013','Thriller','14.99','Taschenbuch','9783453268012','411','','..','..','R1-F2','','','J','1','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('5','Belladonna','Slaughter, Karin','rororo','03.03.2003','Thriller','6.00','Taschenbuch','9783499239140','413','','..','..','R1-F1','Grant County Bd.1','','J','1','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('6','Bis zum letzten Atemzug','Baldacci, David','Bastei Lübbe','01.04.2011','Thriller','9.99','Taschenbuch','9783404165537','574','','..','..','R1-F2','King & Maxwell Bd. 4','austauschen','N','','','');")
_SQLite_Exec(-1, "INSERT INTO Buchverwaltung VALUES('7','Bittere Wunden','Slaughter, Karin','blanvalet','01.09.2014','Thriller','19.99','Hardcover','9783764505172','576','','..','..','R1-F1','Georgia Bd.4','','J','2','','');")
; Änderungsabfrage
MsgBox(0, "SQLite", "Die letzte Abfrage änderte " & _SQLite_Changes() & " Zeile." & @CRLF & _
"Alle Abfragen änderten " & _SQLite_TotalChanges() & " Zeilen.")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Exit() ; Datenbank schließen und down.
_SQLite_Close($g_db_Database)
_SQLite_Shutdown()
;Exit
EndFunc
Alles anzeigen