crickoman Posted April 21, 2008 Posted April 21, 2008 Hello All, I use autoIT since a few years now, but as I am a Tech, not a programmer, I always have used the basic AutoIT functions I needed as a tech. But now I need to go deeper into it. I want to create an application that will use sqlite to store and display information. I am already able to connect to the database and insert some information into it, using _Sqlite_Open and _Sqlite_exec. but I also would like to retrieve the data and display it in a listview I created on the gui. And this is where I am in trouble... I saw exemples in the help file, but this is not what I want...I tried the _Array_display, and it works as I can see the data, but I don't want to have a listview that pops up. I feel I should use the _sqlite_gettable2d (it's working also), but how can I pass the $aResult to the listview ? This is where I am lost... Can somebody can give me a few pointers on How can I do that ? thanks a lot... Chris
zorphnog Posted April 21, 2008 Posted April 21, 2008 You just need to remove the header row from the returned array and pass it to _GUICtrlListView_AddArray. Roughly something like this (assuming the listview is created with the proper headers elsewhere): #include <array.au3> #include <sqlite.au3> #include <sqlite.dll.au3> Local $aResults, $iRows, $iColumns If _SQLite_GetTable2d(-1, "SELECT * FROM my_table;", $aResults, $iRows, $iColumns) = $SQLITE_OK Then _ArrayDelete($aResults, 0) _GUICtrlListView_AddArray($hListView, $aResults) EndIf
crickoman Posted April 21, 2008 Author Posted April 21, 2008 Wow thanks for the quick answer zorphnog... I did a quick test based on your example, and I get an error on the _ArrayDelete line : (C:\Program Files\AutoIt3\Include\Array.au3 (139) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: ) , but if I comment it out, it works, except for the headers that must be removed. The listview is populated with the data I want. Now I'll just have to review my code to fix the _ArrayDelete issue. Maybe my listview is not created correctly... Thanks very much for your precious help ! Chris
crickoman Posted April 21, 2008 Author Posted April 21, 2008 Finally, got it working... looking through the forums for more info on _ArrayDelete, it seems that others have had problems to make it work with 2d arrays, so I just downloaded Randallc Array2d.udf, try the _ArrayDelete2d function and it works now !! thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now