Solved

referencing dll not in system32

Posted on 2009-07-09
3
306 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:luca2009
  • 2
3 Comments
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 24813439
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
 

Author Comment

by:luca2009
ID: 24813776
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
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 500 total points
ID: 24815384
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL Backup Strategy 15 55
Output in PHP throwing alignment of data off issue 12 54
i am unable to add data to mysql database 6 48
Problem with MySQL query - graph 3 22
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question