在Win 7中以C#连接到Mysql DB时出错 [英] Error while connecting to Mysql DB in c# in win 7

查看:81
本文介绍了在Win 7中以C#连接到Mysql DB时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在c#中开发了一个应用程序,并使用mysql作为后端.我已经使用ADODB来连接数据库.我使用DSN进行通信.

现在我有问题,我必须在有3台互连的计算机(LAN)的客户处安装.其中1个是XP,带有Win7的1laptop和带有Win7的其他台式机.一切在笔记本电脑和XP机器上都能正常运行,但是当我尝试使用Win 7在桌面上运行Application时,会出现以下错误.实际上,我能够使用其他两台计算机上的win7(此服务器作为服务器)连接到此桌面.数据已正确插入.所以我不明白这台服务器是什么问题.我收到以下错误消息.

Hi,
i developed an application in c# and using mysql as back end. I have used ADODB for connecting to DB. I use DSN for communicating.

Now i have problem i have to install at my clients place where there are 3 machines interconnected (LAN). out of which 1 is XP, 1laptop with win7 and other Desktop with win7. Every thing working perfect on Laptop and XP machine but when i try to run Application on Desktop with win 7 it give following error. Actually i am able to connect to this desktop with win7 (this is working as server) from other two machines. Data is getting inserted properly. So i dont understand what is the problem with this server machine. I am getting following error message.

 System.Net.Sockets.SocketException: The system detected an invalid pointer address in attempting to use a pointer argument in a call
   at System.Net.Sockets.Socket.GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
   at System.Net.Sockets.NetworkStream.get_ReadTimeout()
   at MySql.Data.MySqlClient.TimedStream..ctor(Stream baseStream)
   at MySql.Data.MySqlClient.MySqlStream..ctor(Stream baseStream, Encoding encoding, Boolean compress)
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at construction.clsConnect..ctor()
   at construction.frmNewSupplierEntryForm..ctor()
   at construction.frmMainMenu.supplierToolStripMenuItem_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
  

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    Cod
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:
<configuration>
    <system.windows.forms jitdebugging="true" />
</configuration>


启用JIT调试后,所有未处理的异常都会发送到计算机上注册的JIT调试器,而不是由此对话框处理.

如果有人纠正我的问题,它将对gr8有所帮助.我想在这里提及的是,我在整个项目中都没有使用过与套接字"相关的代码.所以请指导我.由于这个问题,我绝对被困住了.

谢谢您


When JIT debugging is enabled, any unhanded exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

It will be gr8 help if any one rectify my problem. I would like to mention here is that i have not at all used this "Socket" related code in the whole project. So please guide me. I am absolutely stuck up due to this problem.

Thanking you

推荐答案

这是一个已定义的错误.如果应用程序传递了无效的指针值,或者缓冲区的长度太小,则会发生此错误.例如,如果参数的长度(sockaddr 结构)小于sizeof(sockaddr).

参考: MSDN:Windows套接字错误代码 [ ^ ]
It''s a defined error. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).

Refer: MSDN: Windows Sockets Error Codes [^]


感谢您的回复
你能告诉我解决方案吗...我应该在哪里对程序进行更改...你能告诉我吗..
我没有在整个项目中的任何地方使用套接字之类的东西.所以请给我打电话
谢谢
thanks for ur reply
can u tell me the solution ... where should i make changes into my program...can u please tell me..
I have not used socket sort of thing any where in the whole project. So plz tel me
Thank you


这篇关于在Win 7中以C#连接到Mysql DB时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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