本文介绍了Mysql异常超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有几个标签可以在datagrid上加载一些数据,第一个标签工作正常,但另外6个标签导致程序冻结。我该如何修复它? 这是我对tabcontrol_selectedindexchanged特殊的代码 代码: b $ b [C#]代码 - Pastebin.com [ ^ ] 我尝试了什么: 尝试重组所有代码,从地面0开始没有成功...I have several tabs that load some data on datagrid, the 1st tab works fine, but the 6 others cause my program to freeze. How can i fix it? This is the code i have for tabcontrol_selectedindexchanged proprietyCode:[C#] Code - Pastebin.com[^]What I have tried:Tried to restructure all the code, from ground 0 with no success...推荐答案 Scribling doodle是正确的,最重要的是你要防止超时,而不是弄清楚如何吸收它。 话虽如此,如果您无法阻止超时发生,您应该尝试执行以下操作: 1.将获取数据的代码放入线程中,这样如果它超时,它会超出主线而不是你的主要形式,这将确保你的应用程序保持响应。 2. H andle例外。如果您遇到超时异常,请处理它,例如为用户提供重试或取消的机会。Scribling doodle is right in the sense that, it is most important that you prevent the timeout rather than working out how to absorb it.Having said that, if you are unable to prevent the timeouts from occurring, you should attempt to do the following:1. Put the code that fetches the data into a thread, so if it times out, it will timeout the thread not your main form, this will make sure that your application remains responsive.2. Handle exceptions. If you're getting a timeout exception, handle it, e.g. give the opportunity for the user to retry or cancel. 这篇关于Mysql异常超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-06 03:58