powerino Active Member Licensed User Jan 18, 2020 #1 Hi, I have a table with 3 record and i want to "export" in a List, using DBUtils.ExecuteMemoryTable. List.size is correct, but if i display the "record" in List, i see some like this: [Ljava.lang.String;@26bd3b0 [Ljava.lang.String;@88aff12 [Ljava.lang.String;@b3dc0d1 and not this: "forno" 1 Tubo" 4 "vetro" 12 why? this is my code, thanks for help B4X: Sub btnExport_Click Dim lista As List lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) Dim str As String 'Msgbox(lista.Size,"") For i=0 To lista.Size-1 str=lista.Get(i) Msgbox (str ,"") Next End Sub
Hi, I have a table with 3 record and i want to "export" in a List, using DBUtils.ExecuteMemoryTable. List.size is correct, but if i display the "record" in List, i see some like this: [Ljava.lang.String;@26bd3b0 [Ljava.lang.String;@88aff12 [Ljava.lang.String;@b3dc0d1 and not this: "forno" 1 Tubo" 4 "vetro" 12 why? this is my code, thanks for help B4X: Sub btnExport_Click Dim lista As List lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) Dim str As String 'Msgbox(lista.Size,"") For i=0 To lista.Size-1 str=lista.Get(i) Msgbox (str ,"") Next End Sub
William Lancee Well-Known Member Licensed User Longtime User Jan 18, 2020 #2 Each item in the list is an ARRAY of strings that represents a record in the result set. Something like... B4X: Dim str() As String 'Msgbox(lista.Size,"") For i=0 To lista.Size-1 str=lista.Get(i) for each s as string in str Msgbox (s ,"") next Next Upvote 0
Each item in the list is an ARRAY of strings that represents a record in the result set. Something like... B4X: Dim str() As String 'Msgbox(lista.Size,"") For i=0 To lista.Size-1 str=lista.Get(i) for each s as string in str Msgbox (s ,"") next Next
powerino Active Member Licensed User Jan 18, 2020 #3 at line 6 i have this error: java.lang.RuntimeException: Method: getSize not found in: java.lang.String Upvote 0
at line 6 i have this error: java.lang.RuntimeException: Method: getSize not found in: java.lang.String
William Lancee Well-Known Member Licensed User Longtime User Jan 18, 2020 #4 I don't know what you have in lista... B4X: Dim lista As List lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) But the following works fine: B4X: Dim lista As List: lista.initialize lista.Add(Array As String("aaa", "bbb", "ccc")) Dim str() As String For i=0 To lista.Size-1 str=lista.Get(i) For Each s As String In str Log(s) Next Next Upvote 0
I don't know what you have in lista... B4X: Dim lista As List lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) But the following works fine: B4X: Dim lista As List: lista.initialize lista.Add(Array As String("aaa", "bbb", "ccc")) Dim str() As String For i=0 To lista.Size-1 str=lista.Get(i) For Each s As String In str Log(s) Next Next
powerino Active Member Licensed User Jan 18, 2020 #5 "s" have this error: Error evaluating expression. Upvote 0
powerino Active Member Licensed User Jan 18, 2020 #6 maybe this is the problem: lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) but i don't know if is correct this code (query is ok) Upvote 0
maybe this is the problem: lista=DBUtils.ExecuteMemoryTable(Connection.mySQL, "SELECT * FROM LavoroTB", Null, 0) but i don't know if is correct this code (query is ok)
William Lancee Well-Known Member Licensed User Longtime User Jan 18, 2020 #7 You need to dimension str as an array. See line 4 of my code. Upvote 0
powerino Active Member Licensed User Jan 18, 2020 #8 William Lancee said: You need to dimension str as an array. See line 4 of my code. Click to expand... Not it works,! Thank you very much Upvote 0
William Lancee said: You need to dimension str as an array. See line 4 of my code. Click to expand... Not it works,! Thank you very much
William Lancee Well-Known Member Licensed User Longtime User Jan 18, 2020 #9 I hope you mean "Now" it works Upvote 0
powerino Active Member Licensed User Jan 18, 2020 #10 William Lancee said: I hope you mean "Now" it works Click to expand... Now , sorry! ;-) Upvote 0
DonManfred Expert Licensed User Longtime User Jan 18, 2020 #11 Please post all your questions in the B4A Qustion forum. They are not related to this forum. Upvote 0