Question

SQL1.ExecNonQuery2("INSERT INTO table1 VALUES(?,?,?)",Array As Object("def",3,4))

I don't seem to understand why the argument list in the above statement is declared in the form of Array as Object('xx','xx''xx').How is it exactly being converted into a list parameter ?

Was it helpful?

Solution

Array As xxx is a shorthand syntax for declaring a new array and assigning the values.

Array As Object("def", 3, 4)

Is equivalent to:

Dim arr As Object(3)
arr(0) = "def" : arr(1) = 3 : arr(1) = 4

Basic4android automatically wraps arrays as lists when needed. The items are not copied, it is the whole array that is wrapped in a list. Therefore the above code is valid as it creates an array which is then wrapped as a List.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top