Casting String- To Object array only works in B4A, not B4i:
dim sArr() as String = Regex.Split(";", sLine)
dim oArr() as Object = sArr
SQL1.ExecNonQuery2("INSERT INTO MyTable VALUES (?,?,?)", oArr)
For B4i you can use this small help function:
Sub ConvertArray(arr() As String) As Object()
Dim iLen As Int = arr.Length
Dim oArr(iLen) As Object
For i = 0 To iLen - 1
oArr(i) = arr(i)
Next
Return oArr
End Sub
I remember that with some SQL-DB properties (could be INTEGER?) the INSERT or UPDATE worked only with object array, not with string array. So in B4A I can cast the array at once in B4i only field by field?
OK, thanks, so I guess, this would be working in B4i and B4A with all TEXT and INTEGER columns in MyTable
B4X:
Dim sArr() as String = Regex.Split(";", sLine) 'sLine like "1234;first text;abcd"
Dim li As List = sArr
SQL1.ExecNonQuery2("INSERT INTO MyTable VALUES (?,?,?)", li)
Yes, it works with String Array, on both B4i and B4A with SQL tables that have text and integer columns!
In my memory I solved an .ExecNonQuery2 error just with changing the string- into an object array. Only that's why I used it in newer projects. But, as I said, actually the string array works.