There a lot of times in my program where I have large arrays of data and I would like to use the power of SQL commands (SUM, GROUP BY, INNER JOIN, ORDER BY) on this information. It is a great tool when you are doing anything beyond the most basic information gathering.

For me to use this ability, everytime I have to take my arrays and dump them into an external Access db, create a recordset and do my work, then extract the information and kill the database. I was wondering if there is another way to harness all the abilities of SQL commands and database tools, without having to actually create an external database each time? I don't know, like maybe just using the basic database engine on an array?? Sometimes it seems like a convoluted process....

Recommended Answers

All 3 Replies

Please post some sample code ur using, some sample data of the arrays. 'll try to figure out something.

Regards
Shaik Akthar

Okay, one example was I had a long array of numbers, and I wanted to do a tally, where I calculated the frequency of each number occuring in the array. I also wanted the tally to be sorted with the numbers of the highest frequency at the top of the list. Programmatically it is several steps, sorting the array, counting through the array, then sorting the tally count at the end. In SQL it is practically one command:

"SELECT Count(DataVals) AS Tally, DataVals " _
                        & "FROM DataString " _
                        & "WHERE DataVals>0 " _
                        & "GROUP BY DataVals " _
                        & "ORDER BY Count(DataVals) DESC "

To do this, I had to put the array into an Access table called DataString. So I had to create then kill an Access database just for this one process. Is there a way to use SQL on arrays without needing to physically create databases?

Upon further searching, I guess the "real" solution is to upgrade to VB .NET and use LINQ.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.