Solved

referencing dll not in system32

Posted on 2009-07-09
3
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Uploading a CSV Data Import via PHP & MySql 3 72
How to extract database info from current month and year 7 45
Survey branching tutorial 11 77
MySQL 6 48
Creating and Managing Databases with phpMyAdmin in cPanel.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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