我可以编写一些代码,当服务器名称更改时检查服务器连接 [英] Can I Write Some Code That Check Server Connection When Server Name Changed

查看:88
本文介绍了我可以编写一些代码,当服务器名称更改时检查服务器连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序vb.net,它的数据库在服务器上,应用程序在网下我想要当用户点击表格程序检查的按钮,如果服务器关闭或关闭消息框显示

问题是服务器名称和用户名以及服务器的传递可能会改变我可以写一些检查服务器连接的代码

按我写的方式动态创建连接字符串并将其保存在xml文件中并在加载时创建连接字符串但我不知道如何检查服务器的连接状态

解决方案

连接到什么服务器类型?



大多数情况下,检查连接的唯一方法是尝试连接并查看是否有任何例外。

hi i have a app vb.net that its database is on server and app is under net i want when user clicks on the button of form the program check and if server is off or close the message box show
the problem is that server name and username and pass of server may be change can i write some code that check server connection
by the way I write sub that create connection string dynamically and save it in xml file and when load form the connection string created but i don't know how check connection state of server

解决方案

Connection to what kind of server?

Most of the time, the only way to "check the connection" is to try and connect and see if it comes back with any exceptions.


这篇关于我可以编写一些代码,当服务器名称更改时检查服务器连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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