How To Use Adodb Parameterized Query With Adarray Data Type In Vbscript?
I have not been able to find an example of how to use this anywhere. I am trying to do a simple SELECT statement with a parameterized query. I want to use the adArray data type. He
Solution 1:
I have no idea which database providers will support arrays.
What I prefer to do is pass the array as a single long string, then use a UDF called Split(). The result is something like this:
sql = "SELECT * FROM table WHERE id IN (Split(?))"set objCmd = Server.CreateObject("ADODB.Command")
myBigString = ConvertArrayToCSV(arrMyArray) ' you have to write this, of courseset objParam = objCmd.Createparameter("@id", 200, 1, length, myBigString)
objCmd.Parameters.Append objParam
Here's a discussion of the Split() concept.
Edit
I corrected the above (the parameter type is 200, not 0x2000), and I also now see that ADO appears to support this syntax:
0x2000OR129' array of strings
0x2000 OR 200 'arrayofvarcharBut I haven't tested this.
Post a Comment for "How To Use Adodb Parameterized Query With Adarray Data Type In Vbscript?"