Here is the complete code if you want to spruce it up with string builder and parameterized query:
B4X:
Dim MyList As List
MyList.Initialize
MyList.AddAll(Array As Int(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20))
Dim sb As StringBuilder
sb.Initialize
sb.Append( " IN(")
For i= 0 To MyList.size -1
Dim f As String = "?"
If i = MyList.Size-1 Then
sb.Append($"${f})"$)
Else
sb.Append($"${f},"$)
End If
Next
rs= SQL.ExecQuery2("SELECT * FROM MXI mxi WHERE mxi.item_id " & sb.ToString, MyList)
EDITED LATER without a full test: You may have to have an array like this to execute the query...
Here is the complete code if you want to spruce it up with string builder and parameterized query:
B4X:
Dim MyList As List
MyList.Initialize
MyList.AddAll(Array As Int(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20))
Dim sb As StringBuilder
sb.Initialize
sb.Append( " IN(")
For i= 0 To MyList.size -1
Dim f As String = "?"
If i = MyList.Size-1 Then
sb.Append($"${f})"$)
Else
sb.Append($"${f},"$)
End If
Next
rs= SQL.ExecQuery2("SELECT * FROM MXI mxi WHERE mxi.item_id " & sb.ToString, MyList)
EDITED LATER without a full test: You may have to have an array like this to execute the query:
B4X:
Dim s() As String = Array As String(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
And use:
B4X:
rs= SQL.ExecQuery2("SELECT * FROM MXI mxi WHERE mxi.item_id " & sb.ToString, s)