Associative arrays - and how to use them... wisely

· November 14, 2008

My questions in an earlier post were promptly answered by Mark A Williams in a great way.

So what he says pretty much confirms what I thought. Although associative arrays are a great way to “bulk in” data to the database, when it comes to returning data, the array-way might not always be right.

Since you have to allocate memory for the array and size of each element in the array, associative arrays are best suited for situations when you know the size of the data that is being returned. Not that often in my experience. In other cases, you’ll be better off with a plain old DataReader.

So now I know - thanks goes to Mark A Williams.

Twitter, Facebook