且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

连接MySQL时出现C#捕获错误

更新时间:2022-10-16 12:11:19

由于您需要检查是否存在连接,您可以使用if语句来执行此操作,如果是,则继续;否则显示消息以避免挂起,请使用
 My.Computer.Network.IsAvailable()


Hello, here's the scenario, when im trying to use my program to other network and that PC doesnt have internet connection, I want to catch the error as soon as possible, that will prompt that the user isn't connected to any network, coz now its throwing that it doesnt connect to MySql, and sometimes it waits and hangs to wait for the connection" i Hope someone can help me with this, BTW im using MysqldataReader to Login

Since you need to check if there is a conection, you can use an if statement to do that, if so, proceed; otherwise show a message to avoid the hangup, use
My.Computer.Network.IsAvailable()