I need to pass an array of 1d variants to an automation object. Right now I am using SafeArrayCreateVector (VT_VARIANT, 0, 2) to create a 1d array and then calling my AddRow(safeArray*) method over and over.
What I want to do is allocate an array of arrays so I can just call my AddRow function once with an array of safearrays. This may sound confusing so here is a simple example of my data (queried from a database)
Row1: UserName ID
Row2: UserName ID
Each time I call AddRow (currently), I am passing an array of variants (safearray) that has 2 VARIANTs (one for UserName and one for ID). I want to be able to pass all the arrays (row 1 through row n) at once.
Is this possible? Also, is it possible to create this array dynamically (I am getting this data from a database, so I really don't know how big it is until it's all done reading)?