.NET的MySQL连接器使应用程序停止工作 [英] MySQL connector for .NET makes application stop working

查看:84
本文介绍了.NET的MySQL连接器使应用程序停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net应用程序(基于Visual Basic),该应用程序最初使用sql服务器数据库,因此我对所有连接都使用了sqlclient库.它工作正常.我想迁移到MySQL数据库.因此,我安装了连接器,并将MySQL.Data.Mysqlclient引用添加到项目中,并稍稍更改了代码,但是现在应用程序无法启动.它说了一些关于无法初始化模块的信息,当我尝试跳过此模块时,它不会绘制表格.它没有显示任何语法错误,并且异常消息似乎与Mysql .dll没有关系,但是我将其改回了sqlclient,现在它又可以工作了.我真的需要使用mysql.

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?

推荐答案

一些更多的信息可能很好,尤其是逐字逐句显示错误消息...您的操作系统(也是32/64位信息)以及.Net的版本也很重要.
根据我对32bit-64bit不兼容的经验,我猜您的程序也可能存在这样的问题.尝试执行以下操作:将项目的目标设置为x86,然后再次检查.
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.


不看代码,几乎无法弄清正在发生的事情.
那并不意味着我要看您的整个程序-所以不要费心发布它!

开始一个新项目.
添加MySql引用,然后编写一个简单的程序,当您按下按钮时,创建一个连接,将其打开,并从DB中读取信息.
运行它,看看它是否有效.
如果是这样,那么问题就出在您现有的代码中,您需要更仔细地与调试器联系,并向我们展示发生故障的地方.
如果没有,则问题出在您的MySql安装上,并且需要一种完全不同的修复类型.
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.


我忘了更改连接字符串!现在感觉有点愚蠢,但是我看不到这,因为我建立了一个类(DBConnection)来管理连接,所以在尝试创建DBConnection对象时发生了错误.这是我上学期的最后一周...我对xD不太专心.
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.


这篇关于.NET的MySQL连接器使应用程序停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆