referencing dll not in system32

I want to refrencing the dll not from system32 but from c:\mydir

this is my real code and the dll is myodbc3.dll:

 

Option Explicit
Dim CONN As ADODB.Connection
Dim RS As ADODB.Recordset
Dim USERNAME As String
Dim PASSWD As String
Dim SERVERIP As String
Dim DB As String
Public Function connectMysql(USERNAME As String, PASSWD As String, SERVERIP As String, DB As String, CONN As ADODB.Connection, RS As ADODB.Recordset)
 
Set CONN = New ADODB.Connection
Set RS = New ADODB.Recordset
PASSWD = "aaaa"
 
CONN.CursorLocation = adUseClient
 
CONN.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & SERVERIP & ";UID=" & USERNAME & ";PWD=" & PASSWD & ";DATABASE=" & DB & ";" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841
CONN.Open
 
End Function
Sub uno()
Call connectMysql("root", "", "xxxxxxxxxx", "TEST", CONN, RS)
End Sub

Open in new window

luca2009Asked:
Who is Participating?
 
HooKooDooKuConnect With a Mentor Commented:
If you are attempting to run an executable program from a computer, you are going to have to find a way to install all of the dependency DLLs.  Period.  The only ways I know to avoid installing "stuff" on 45 pc is to have an ActiveX EXE or browser based application where basically the OS does the updates for you.  But if the project wasn't built from the ground up with that in mind, you are stuck installing the EXE and all dependency DLLs.

If you have no control over the dependancy DLLs, then you are forced to do one of two things (based on the type of DLL).  If it's an ActiveX DLL (for example, a DLL built from VB6), then you have to place the DLL just about anywhere (possibly even network drives) and use Regsrv32.exe to register the DLL (doing so will basically update the registry of the computer to say where the DLL lives).  If the DLL is NOT an ActiveX DLL, then you have to have it located somewhere that the application can find it.  That can be the "working folder" of the application (aka Startup Folder).  If not, the the DLL has to be located in one of the folders listed in the "PATH" environment variable.  System32 will be included in the "PATH" of basically every windows machine.  But you have the control (manually, as well as with instilation applications) to add what ever folder that you want to that "PATH".

The only other choise I've ever heard of is developer applications that can take an EXE and dependancy DLLs and wrap them together in to one giant EXE.  But that's 3rd party apps you have to get into.

I guess bottom line, if your application is going to use "MySQL ODBC 3.51 Driver", you've GOT TO install that driver (and any dependancy DLLs) on every machine you want to be able to run your application on.  You will have to do it manually, write an application/script yourself, or look into third-party tools that help you build instilation applications... or rebuild the application from the ground up to be browser based.  
0
 
HooKooDooKuCommented:
Either the dll needs to be an Active X DLL...
  if so, then when the dll is registered, the location of the DLL will be recorded in the registry...

Or the dll needs to be located in a folder that is included in the Environment Variables/System Variable "PATH" (or update your "PATH" system environment variable to include "C:\MyDir".

Under XP, you will find PATH in ...
Settings, Control Panel, System Properties, Advanced Tab, Environment Variables Button.  Path is specifically in the values in the lower section.  Once modified (by adding ";C:\MyDir" to the end of the existing Path") you might have to restart your computer.
0
 
luca2009Author Commented:
Complicated for me....
In other case the original my prob is:

When i run the code on pc where is intalled "The Connector 3.5.1-MySql" all work fine an i connect the project with no prob...
The prob is when i run a code on pc where not is installed the "The Connector 3.5.1-MySql" have error not found provider ecc....

I think because the dll not is installed on pc of other user.

I dont want to install for each pc in my lan (45 pc)  "The Connector 3.5.1-MySql", sure!

If have other solution to connect mysql with the standard configuration of pc are welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.