Question

Dim m As Map
m = DBUtils.ExecuteMap(SQL, "SELECT Id, [First Name], [Last Name], Birthday FROM students WHERE id = ?", _Array As String(value))

Why is third argument needed in DBUtils.ExecuteMap ? I tried looking in DBUtils code module but didnt understand anything.

Was it helpful?

Solution

The third argument is an array (or list) of values that replace the question marks in the query, which is a parameterized query. This way we do not need to escape the string values and it is also easier to build the query as we don't need to concatenate the query and the variables.

You can pass Null if it is not needed (for example, if the query is constant).

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