| | |
Using database tools inside VB6
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 56
Reputation:
Solved Threads: 0
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....
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....
•
•
Join Date: Jan 2008
Posts: 56
Reputation:
Solved Threads: 0
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:
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?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"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?
Last edited by Tekito; Nov 10th, 2008 at 10:32 am.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Report Setup
- Next Thread: ADDNEW Method Problem
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





