PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Henning Thomsen on November 06, 2006, 04:28:27 PM

Title: Database connection from a DLL
Post by: Henning Thomsen on November 06, 2006, 04:28:27 PM
I  have in a DLL created a connection to a database (Access), opened a recordset, set index. I have in the same DLL created a function: Function Data1 Alias "Data1" (ByVal vCrit1 As String, ByVal vCrit2 As String) Export As String
In this function I use a command: FF_AdoRecordset_Seek(AccountTab,vCrit(), 1)
I am now able to send data to vCrit1 and vCrit2 and to get a string back from a function in VB6/VBA: Declare Function Data1 Lib "Data.dll" (ByVal vCrit1 As String, ByVal vCrit2 As String) As String
It works fine but now I want to move the function from the DLL to the VB6/VBA-area. This means that the DLL should only create connections, open recordsets, set indexes, etc. Use of the recordsets should now be handled by VB6/VBA. In this way I could use the DLL as a general procedure that could support various VB6/VBA routines.

Is it possible to do in this way? If so what about “Export As String”. Of course it cannot be a string but what should I then export from the DLL?
Title: Database connection from a DLL
Post by: TechSupport on November 08, 2006, 12:22:11 PM
Integration to and from VB/VBA is outside my range of experience. I have not used Visual Basic in a good number of years (and I plan to stay away from it other than trying to test the new Cheetah Database source code for compatibility with it).

Sorry. :(   Maybe other FireFly/PowerBASIC users have had success using ADO/DAO in the way that you need.

Come to think of it.... If you are using VB then you can use ADO/DAO without having to move routines to a DLL. Putting the routines in the DLL just seems like one extra layer of indirection and does not serve any useful purpose????