M mechanicaltesla Member Licensed User Longtime User Jan 20, 2019 #1 Hi, Can someone please explain how to obtain the values for all the columns of the single record/Result as list obtained in SQLite? Trying to get a list of the results and put on a tableview... one column with the Column names of the SQlite and another column from the SQLite results. 1. "select * from DATABASE where key="2.3754.60" 2. I get the following from the SQLite command above. KEY COL1 COL2 COL3 COL4 COL5 COL6 COL7 ---> names of columns "2.3754.60" "value1" "value2" "value3" "value4" "value5" "value6" "value7" ---> single row of values 3. Not sure how to set up the code Do While ResultSet4.NextRow Dim Row(ResultSet4.ColumnCount) As Object Loop 4. In the TableView, I would like to see the Results as KEY 2.3754.60 COL1 Value1 COL2 Value2 COL3 Value3 COL4 Value4 so on... any help is appreciated
Hi, Can someone please explain how to obtain the values for all the columns of the single record/Result as list obtained in SQLite? Trying to get a list of the results and put on a tableview... one column with the Column names of the SQlite and another column from the SQLite results. 1. "select * from DATABASE where key="2.3754.60" 2. I get the following from the SQLite command above. KEY COL1 COL2 COL3 COL4 COL5 COL6 COL7 ---> names of columns "2.3754.60" "value1" "value2" "value3" "value4" "value5" "value6" "value7" ---> single row of values 3. Not sure how to set up the code Do While ResultSet4.NextRow Dim Row(ResultSet4.ColumnCount) As Object Loop 4. In the TableView, I would like to see the Results as KEY 2.3754.60 COL1 Value1 COL2 Value2 COL3 Value3 COL4 Value4 so on... any help is appreciated
KMatle Expert Licensed User Longtime User Jan 20, 2019 #2 Search for Sqlite & Examples. Nice code examples from @klaus Upvote 0
M mechanicaltesla Member Licensed User Longtime User Jan 20, 2019 #3 Do While ResultSet4.NextRow Dim Row As String Dim l7 As List : l7.Initialize For col=0 To ResultSet4.ColumnCount-1 l7.Add(ResultSet4.GetColumnName(col)) Next Log(l7) resultstableview.Items=l7 End Sub I Get java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; Upvote 0
Do While ResultSet4.NextRow Dim Row As String Dim l7 As List : l7.Initialize For col=0 To ResultSet4.ColumnCount-1 l7.Add(ResultSet4.GetColumnName(col)) Next Log(l7) resultstableview.Items=l7 End Sub I Get java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;
Daestrum Expert Licensed User Longtime User Jan 20, 2019 #4 You are only adding one item into each list item the column name, but the tableview wants 2 items the name and the value in each list item. You need to add the columnname AND the value to each list item. eg something like Code: Copy l7.Add(Array(ResultSet4.GetColumnName(col),ResultSet4.getInt2(col))) Also the Loop keyword is missing for the Do While Last edited: Jan 20, 2019 Upvote 0
You are only adding one item into each list item the column name, but the tableview wants 2 items the name and the value in each list item. You need to add the columnname AND the value to each list item. eg something like Code: Copy l7.Add(Array(ResultSet4.GetColumnName(col),ResultSet4.getInt2(col))) Also the Loop keyword is missing for the Do While
M mechanicaltesla Member Licensed User Longtime User Jan 20, 2019 #5 Do While ResultSet4.NextRow Dim l7 As List : l7.Initialize Dim l8 As List : l8.Initialize For col=0 To ResultSet4.ColumnCount-1 l7.Add(ResultSet4.GetColumnName(col)) '--------> I get Arrays with Columns Names l8.add(ResultSet4.GetString(ResultSet4.GetColumnName(col))) '--------> I get an Array with all the values Next Loop ' Now the problem is adding this to the Tableview (column 1 list7, column 2 list 8) I tried different ways resultstableview.Items = l7 resultstableview.Items = l8 'java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; resultstableview.Items.addall(l7) resultstableview.Item.addall( l8) 'java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; thanks Daestrum I'll try it Upvote 0
Do While ResultSet4.NextRow Dim l7 As List : l7.Initialize Dim l8 As List : l8.Initialize For col=0 To ResultSet4.ColumnCount-1 l7.Add(ResultSet4.GetColumnName(col)) '--------> I get Arrays with Columns Names l8.add(ResultSet4.GetString(ResultSet4.GetColumnName(col))) '--------> I get an Array with all the values Next Loop ' Now the problem is adding this to the Tableview (column 1 list7, column 2 list 8) I tried different ways resultstableview.Items = l7 resultstableview.Items = l8 'java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; resultstableview.Items.addall(l7) resultstableview.Item.addall( l8) 'java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object; thanks Daestrum I'll try it
DonManfred Expert Licensed User Longtime User Jan 21, 2019 #6 Please use [CODE]code here...[/CODE] tags when posting code. Upvote 0