943,915 Members | Top Members by Rank

Ad:
Nov 7th, 2008
0

Using database tools inside VB6

Expand Post »
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....
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Tekito is offline Offline
56 posts
since Jan 2008
Nov 8th, 2008
0

Re: Using database tools inside VB6

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

Regards
Shaik Akthar
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Nov 10th, 2008
0

Re: Using database tools inside VB6

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:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. "SELECT Count(DataVals) AS Tally, DataVals " _
  2. & "FROM DataString " _
  3. & "WHERE DataVals>0 " _
  4. & "GROUP BY DataVals " _
  5. & "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?
Last edited by Tekito; Nov 10th, 2008 at 10:32 am.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Tekito is offline Offline
56 posts
since Jan 2008
Nov 12th, 2008
0

Re: Using database tools inside VB6

Upon further searching, I guess the "real" solution is to upgrade to VB .NET and use LINQ.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Tekito is offline Offline
56 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Report Setup
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: ADDNEW Method Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC