Just done the googling and forum search, but couldn't find solution to my need. I'm having difficulties understanding arrays (yes I've read help file).. So I'm asking for help.
Below is the code, I want to populate GUICtrlSetData with sql query output, i've defined $array2 to convert array to string with | as delimiter. In that table I have 3 fields as it can be seen, so when the createlist gui appears, there would have to be structure like:
Surname Name - Code
Surname1 Name1 - Code1
etc...
When I launch the script, GUI appears and disappears instantly...
GuiCtrlSetData is normaly populated like this... so this would be desired output.
GUICtrlSetData(-1,"value 1|value 2|value 3")
Below is the code, I want to populate GUICtrlSetData with sql query output, i've defined $array2 to convert array to string with | as delimiter. In that table I have 3 fields as it can be seen, so when the createlist gui appears, there would have to be structure like:
Surname Name - Code
Surname1 Name1 - Code1
etc...
When I launch the script, GUI appears and disappears instantly...
GuiCtrlSetData is normaly populated like this... so this would be desired output.
GUICtrlSetData(-1,"value 1|value 2|value 3")
[ autoit ]
#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <Guilistview.au3> $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.ConnectionString = "driver={SQL Server};SERVER=1.1.1.1;database=DbTEST;uid=user;pwd=password" $sqlCon.Open $status = $sqlCon.State ; request/insert data $strSQL = "SELECT [Code], [Surname], [Name] FROM [DbTEST].[dbo].[Employees] ORDER BY [Surname]" $result = $sqlCon.execute($strSQL) $array = $result.GetRows ;_ArrayDisplay($Array) - this is for test / array displays fine, no connection issues $array2 = _ArrayToString($Array,"|",1) $hGUI = GUICreate("Users", 300, 300) $cInput = GUICtrlCreateList("", 10, 10, 280, 250) GUICtrlSetData(-1, $array2) $cButton = GUICtrlCreateButton("Confirm", 10, 260, 50) GUISetState()