I Have a code like this:
I have 5 rows in a query and six columns. I need them in a List too. In a last loop (for... next) I get only the 5th row. What I'm doing wrong? Please advice.
B4X:
curs1 = Main.SQL1.ExecQuery(query1)
orart2V.Clear
Do While curs1.NextRow
orart2H.Clear
For col = 0 To curs1.ColumnCount - 1
orart2H.Add(curs1.GetString2(col))
Private lbl As Label
lbl.Initialize("Cell")
CSSUtils.SetBorder(lbl, 1, fx.Colors.DarkGray, 5)
lbl.Alignment = linel(col)
innerPane1.AddNode(lbl, mw(col), row * h, mw(col+1) - mw(col) - 1, h - 1)
lbl.Text = curs1.GetString(curs1.GetColumnName(col))
lbl.TextSize = 16
Next
Log("list = " & orart2H)
orart2V.Add(orart2H)
Log(orart2V.Get(row)) ' So far so good
row = row + 1
sumb = sumb + curs1.GetString2(4)
nro = curs1.GetString2(0)
Loop
curs1.close
Log(orart2V.Size)
Dim mn1, mg1 As Int
For mn1 = 0 To orart2V.Size - 1
Dim child As List = orart2V.Get(mn1)
For mg1 = 0 To orart2H.Size - 1
Log(mn1 & " - " & mg1 & " -- " & child.Get(mg1)) ' but here is no good
Next
Next
I have 5 rows in a query and six columns. I need them in a List too. In a last loop (for... next) I get only the 5th row. What I'm doing wrong? Please advice.
B4X:
' here is the log.
list = (ArrayList) [1, One, 1.000, 300.00, 300.00, 6]
[1, One, 1.000, 300.00, 300.00, 6]
list = (ArrayList) [2, Two, 2.000, 300.00, 600.00, 7]
[2, Two, 2.000, 300.00, 600.00, 7]
list = (ArrayList) [2, Three, 1.000, 100.00, 100.00, 3]
[2, Three, 1.000, 100.00, 100.00, 3]
list = (ArrayList) [2, Four, 1.000, 80.00, 80.00, 1]
[2, Four, 1.000, 80.00, 80.00, 1]
list = (ArrayList) [2, Five, 1.000, 100.00, 100.00, 2]
[2, Five, 1.000, 100.00, 100.00, 2]
5
0 - 0 -- 2
0 - 1 -- Five
0 - 2 -- 1.000
0 - 3 -- 100.00
0 - 4 -- 100.00
0 - 5 -- 2
1 - 0 -- 2
1 - 1 -- Five
1 - 2 -- 1.000
1 - 3 -- 100.00
1 - 4 -- 100.00
1 - 5 -- 2
2 - 0 -- 2
2 - 1 -- Five
2 - 2 -- 1.000
2 - 3 -- 100.00
2 - 4 -- 100.00
2 - 5 -- 2
3 - 0 -- 2
3 - 1 -- Five
3 - 2 -- 1.000
3 - 3 -- 100.00
3 - 4 -- 100.00
3 - 5 -- 2
4 - 0 -- 2
4 - 1 -- Five
4 - 2 -- 1.000
4 - 3 -- 100.00
4 - 4 -- 100.00
4 - 5 -- 2
Last edited: