Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ButtonConstants.au3>
- #include <ComboConstants.au3>
- #include <DateTimeConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <GuiToolbar.au3>
- #include <StaticConstants.au3>
- #include <TabConstants.au3>
- #include <ToolbarConstants.au3>
- #include <WindowsConstants.au3>
- #include <GuiComboBox.au3>
- #include "mysql.au3"
- ; *. ini file !
- $ini = "test.ini"
- ; Funktionen
- ; ini file auslesen und füllen
- Func ReadSection ($isection)
- Dim $section, $sectiong
- $section = IniReadSection ($ini, $isection)
- For $i=1 To $section[0][0]
- $sectiong = $sectiong & $section[$i][1] & "|"
- Next
- Return $sectiong
- EndFunc
- ; mysql connect
- $UserName = "root"
- $Password = ""
- $Database = "auto"
- $MySQLServerName = "localhost"
- $table = "form"
- $sql = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)
- ; Felder erstellen
- $ortr = ReadSection("ort")
- $smt = ReadSection("test2")
- ; MYSQL Tabelleneinträge laden, wenn vorhanden
- Func DisplayTable()
- $NameList = ""
- $SQLCode = "SELECT * FROM form"
- $TableContents = _Query ($sql, $SQLCode)
- With $TableContents
- While Not .EOF
- ;$NameList &= .Fields ("form_id").value & "." & .Fields ("form_name").value & "|"
- $NameList &= .Fields ("form_name").value & "|"
- .MoveNext
- WEnd
- EndWith
- Return $NameList
- EndFunc
- $test = "Bitte Ort auswählen"
- $lod = DisplayTable()
- #Region ### START Koda GUI section ### Form=
- $Form1 = GUICreate("test form", 635, 513, 188, 139)
- $Group1 = GUICtrlCreateGroup("Test Gruppe", 16, 136, 601, 345)
- $speichern = GUICtrlCreateButton("speichern", 232, 432, 121, 33, 0)
- $Label1 = GUICtrlCreateLabel("Name", 48, 176, 32, 17)
- $name = GUICtrlCreateInput("", 112, 176, 137, 21)
- $Ort_label = GUICtrlCreateLabel("Ort", 48, 208, 18, 17)
- $ort = GUICtrlCreateCombo($test, 112, 208, 145, 25)
- $ortset = GUICtrlSetData(-1,$ortr)
- $Label2 = GUICtrlCreateLabel("test2", 48, 240, 55, 17)
- $test2 = GUICtrlCreateCombo("Bitte test2 wählen", 112, 240, 145, 25)
- GUICtrlSetData(-1,$smt)
- $lli = GUICtrlCreateCombo("Eintrag laden", 120, 48, 145, 25)
- GUICtrlSetData(-1,$lod)
- $load = GUICtrlCreateButton("Button1", 272, 48, 75, 25, $WS_GROUP)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- $msg = GUIGetMsg()
- ; Ausgewählten Eintrag laden
- Func LoadEntry()
- $lentry = ""
- $SQLCode = "SELECT * FROM form WHERE form_name = '"& GUICtrlRead($lli) &"'"
- $TableContents = _Query ($sql, $SQLCode)
- With $TableContents
- $lentry &= .Fields ("form_id").value & "." & .Fields ("form_name").value
- EndWith
- MsgBox(0,"bla",$lentry)
- EndFunc
- While 1
- $msg = GUIGetMsg()
- Select
- Case $msg = $GUI_EVENT_CLOSE
- ExitLoop
- Case $msg = $speichern
- ; mysql felder
- Dim $test[4]
- $test[0] = "form_id"
- $test[1] = "form_name"
- $test[2] = "form_ort"
- $test[3] = "form_test2"
- ; form_id form_name form_ort form_test2
- ; form variablen
- Dim $values[4]
- $values[0] = ""
- $values[1] = GUICtrlRead($name)
- $values[2] = GUICtrlRead($ort)
- $values[3] = GUICtrlRead($test2)
- _AddRecord($sql, $table, $test, $values)
- MsgBox(0, 'Test', "Eintrag erfolgreich angelegt")
- Case $msg = $load
- LoadEntry()
- GUICtrlSetData($name,"TEST")
- GUICtrlSetData($ort,"bla",Default)
- EndSelect
- WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement