PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Database connection from a DLL  (Read 202 times)

Henning Thomsen

  • Guest
Database connection from a DLL
« on: November 06, 2006, 03:58: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:
Code: [Select]
Function Data1 Alias "Data1" (ByVal vCrit1 As String, ByVal vCrit2 As String) Export As String
In this function I use a command:
Code: [Select]
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:
Code: [Select]
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?
Logged

TechSupport

  • Guest
Database connection from a DLL
« Reply #1 on: November 08, 2006, 11:52:11 AM »

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????
Logged