Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a .net application (visual basic) that originaly used a sql server data base, therefore I used the sqlclient library for all the connections. It works fine. I want to migrate to a MySQL data base. So I installed the connector and added the MySQL.Data.Mysqlclient reference to the project and changed the code a bit, but now the application wont start. It says something about not being able to initialize a module and when I tried to skip this It wouldn't draw the forms. It doesn't show any syntax errors and the exception messages don't seem to be related with the Mysql .dll but I changed it back to sqlclient and now it works again. I really need to use mysql. any ideas as to why this is happening?
Posted

Some more information could be nice, especially the error message word by word... Your operating system (also 32/64bit info), and the version of .Net are also important.
From my experience with 32bit-64bit incompatibilities, I guess that there might be such an issue with your program too. Try following: set the target of your project to x86, and check again.
 
Share this answer
 
Comments
Vic91 31-Jul-12 2:31am    
I'm using .net framework 4.0 on a 32 bit OS.
I didn't write the error message because.. well look:
"An exception occurred in initializer type Globals" (Globals is a module).
it basically won't initialize any form or module in the project. And I have used the same instance of the connector for a different application that worked just fine just a couple of months ago. I can't make any sense of it because I keep changing it from sql server to mysql and it works with the first but not with the second.
Vic91 31-Jul-12 2:50am    
This is embarrasing.. I forgot to change the connection string. I couldn't see this was the problem because I built a class to manage data base connections and the error I got was when instatiating this class. Thanks anyways.
Without seeing the code, it is pretty much impossible to work out what is going on.
And that doesn't mean I want to see your entire program - so don't bother posting it!

Start a new project.
Add the MySql reference, and then write a simple program that when you press a button, creates a connection, opens it, and reads info from the DB.
Run it and see if it works.
If it does, then the problem is in your existing code, and you need to look a lot more closely with the debugger and show us where it is failing.
If it doesn't, then the problem is with your MySql installation, and needs a totally different type of fix.
 
Share this answer
 
Comments
Vic91 31-Jul-12 2:50am    
This is embarrasing.. I forgot to change the connection string. I couldn't see this was the problem because I built a class to manage data base connections and the error I got was when instatiating this class. Thanks anyways.
OriginalGriff 31-Jul-12 3:07am    
:laugh:
We all make mistakes!
I had forgotten to change the connection string! Feeling a bit stupid right now but I couldn't see this because I built a class (DBConnection) to manage the connections so the error ocurred when I tried to create a DBConnection object. This is my last week for the term... I'm a bit unfocused xD.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900