没有连接的错误. [英] error for No Connection..

查看:82
本文介绍了没有连接的错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道要为..:
编写代码的代码吗?
如果找不到数据库,那么

does anyone know the code to make an code for..:

if the database can''t be found then

MessageBox.Show("there is no database..")



是我必须使用数据库的名称和位置还是可以使用连接字符串?



doe I have to use the name and location of the database or can i use the connectionstring?

推荐答案

方法之一:具有有效的连接字符串.尝试使用该连接字符串连接到数据库.如果应用程序无法连接,则将发生超时错误.捕获错误并显示您的消息框.
One of the ways: You will have a valid connectionstring. Try to connect to database using that connection string. If application fail to connect then a timeout error would happen. Trap the error and show your message box.


您可以在以下链接上找到代码片段:
检查数据库是否存在 [ ^ ]
如何检查SQL Server中是否存在数据库 [ ^ ]

以下文章可能对您有帮助,关于cp to的好文章
检查数据库中是否存在表或字段 [ ^ ]
You can find a code snippet on following link:
check whether database exists[^]
How to check if a database exists in SQL Server[^]

And following article might help you, a good article on cp to
Check if a table or field exists in a database[^]


检查以下链接
http://social.msdn.microsoft.com /Forums/zh-CN/transactsql/thread/7f21cb27-c939-4a89-98d7-0a8ec7ae0d8b/ [
Check following link
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/7f21cb27-c939-4a89-98d7-0a8ec7ae0d8b/[^]

Hope it helps.


这篇关于没有连接的错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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