Hallo,
Habe einen Access DB:
Wo ich aus einer bestimmten Tabele mit verschieden Feldern.
Infos in einer Gui darstellen will
den anfang habe ich gemacht komme aber nicht weiter.
Ich kann zur zeit aus der Tabele lesen und den inhalt von feld 1auslesen
1.wie kann ich das in die Listview[0] Schreiben?(Als Consolewrite geht es)
2.Wenn ich die Items in der Listview[0] habe und dort ein item anklicke,
wie kann ich dann aus den anderen feldern die info in die Listview schreiben bzw. editbox.
Geht mir eigentlich haupsächlich um das lesen der entsprechenden "feldnamen"
Spoiler anzeigen
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
global $dbname = @ScriptDir & "\OPTM CISM_be.mdb" ; Datenbankpfad und Datei-/Datenbankname
global $tblname = "tbl_Incident"
Global $fldname = "Task_Aufgabenname"
Global $format = "Text(50)"
Global $data = "Blah Blah Blah"
Global $ListView[9]
Global $sDir = @ScriptDir & '\csv\'
Global $aFiles = _FileListToArray($sDir, '*.csv', 1), $sComboFiles
If Not @error Then
For $i = 1 To $aFiles[0]
$sComboFiles &= $aFiles[$i] & '|'
Next
$sComboFiles = StringTrimRight($sComboFiles, 1)
EndIf
#Region ### START Koda GUI section ### Form=F:\autoit\entwicklung\CISM\Form1.kxf
$Form1 = GUICreate("BMC", 949, 555, 197, 277)
$ListView[0] = GUICtrlCreateListView("1 Short decription", 32, 96, 234, 422)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
;$Combo1 = GUICtrlCreateCombo("Combo1", 32, 16, 233, 25)
$Combo2 = GUICtrlCreateCombo("Liste Auswählen", 32, 72, 233, 25)
GUICtrlSetData(-1, $sComboFiles)
;$Inputun = GUICtrlCreateInput("", 32, 32, 151, 21)
;GUICtrlCreateLabel("Caller ", 32, 10, 60, 20)
;$Input2 = GUICtrlCreateInput("Input1", 449, 16, 143, 21)
;$Input3 = GUICtrlCreateInput("Input1", 601, 16, 143, 21)
;$Input4 = GUICtrlCreateInput("Input1", 286, 50, 151, 21)
;$Input5 = GUICtrlCreateInput("Input1", 446, 50, 143, 21)
;$Input6 = GUICtrlCreateInput("Input1", 598, 50, 143, 21)
;$Input7 = GUICtrlCreateInput("Input1", 755, 20, 143, 21)
;$Input8 = GUICtrlCreateInput("Input1", 759, 49, 143, 21)
;$ListView[1] = GUICtrlCreateListView("2 Detail", 273, 96, 294, 211)
$ListView[1] = GUICtrlCreateEdit("2 Detail", 273, 96, 294, 211)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 280)
;$ListView[2] = GUICtrlCreateListView("3 Way of Solution ", 273, 305, 294, 211)
$ListView[2] = GUICtrlCreateEdit("3 Way of Solution ", 273, 305, 294, 211)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 280)
$ListView[3] = GUICtrlCreateListView("4 Classification", 572, 95, 146, 54)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 140)
$ListView[4] = GUICtrlCreateListView("5 Compnent Type", 572, 150, 146, 54)
[/autoit] [autoit][/autoit] [autoit]GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 140)
$ListView[5] = GUICtrlCreateListView("6 Component", 572, 200, 146, 54)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
$ListView[6] = GUICtrlCreateListView("7 Assined To Group", 572, 305, 146, 55)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
$ListView[7] = GUICtrlCreateListView("8 Submitter Group", 572, 369, 146, 54)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
$ListView[8] = GUICtrlCreateListView("9 Client", 572, 420, 146, 54)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
;$Userladen = GUICtrlCreateButton("Userladen", 800, 75, 75, 17, $WS_GROUP)
;$Userdel = GUICtrlCreateButton("löschen", 800, 58, 75, 17, $WS_GROUP)
$Dbread = GUICtrlCreateButton("DB Lesen", 50, 520, 75, 17, $WS_GROUP)
;$ListView10 = GUICtrlCreateListView("UserID|im Ad vorhanden", 750, 96, 186, 422)
;GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]#EndRegion ### END Koda GUI section ###
[/autoit] [autoit][/autoit] [autoit];GUICtrlSetData($Inputun, $user2)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Dbread
$test = _ReadOneFld($tblname, $dbname, $fldname)
ConsoleWrite($test)
GUICtrlCreateListViewItem($test, $ListView[1])
EndSwitch
WEnd
Func _ReadOneFld($_sql, $_dbname, $_field)
Dim $_output
$adoCon = ObjCreate ("ADODB.Connection")
$adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $_dbname)
$adoRs = ObjCreate ("ADODB.Recordset")
$adoRs.CursorType = 1
$adoRs.LockType = 3
$adoRs.Open ($_sql, $adoCon)
With $adoRs
If .RecordCount Then
While Not .EOF
$_output = $_output & .Fields ($_field).Value & @CRLF
.MoveNext
WEnd
EndIf
EndWith
$adoCon.Close
Return $_output
EndFunc