使用try catch等待 [英] Using try catch with await

查看:123
本文介绍了使用try catch等待的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想连接到SqlServer,如果连接有任何问题,我想使用try和catch系统来控制错误,并且显然尝试使用await捕获无法工作,并且不会控制错误。


现在该如何控制错误?


谢谢。

解决方案

< blockquote>

为什么你说"尝试抓住不能等待"?


我认为Backgroundworker类比许多人想象的更有用。


I want to connect to a SqlServer and if the connection had any problem i want to use try and catch system to control the errors and apparently try catch cant work with await and will not control the errors.

now what should i do to control the errors?

Thanks.

解决方案

Why do you say that "try catch cant work with await"?

I think that the Backgroundworker class is more useful than many people think.


这篇关于使用try catch等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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