检测SQL Server连接

string   CONN_STRING_NON_DTC   =   "server=RL;database=GBGDS;Uid=sa;Pwd=sa "
public   static   bool   isConnecting()
{

SqlConnection   conn   =   new   SqlConnection(CONN_STRING_NON_DTC);
try
{
if(Detect(ConfigurationSettings.HL7Config.SqlServerAddress)   ==   false)
return   false;
else
{
conn.Open();
conn.Close();
return   true;
}

}
catch(Exception   e)
{

return   false;
}

}

posted on 2011-12-09 14:07  老咸菜  阅读(213)  评论(0编辑  收藏  举报