// 测试数据库链接
public static bool TestDBConnect(string strDSN)
{
bool bReturn = true;
SqlConnection oSqlConnection = new SqlConnection(strDSN);
int iTmp = oSqlConnection.ConnectionTimeout;
try
{
oSqlConnection.Open();
}
catch
{
bReturn = false;
}
finally
{
oSqlConnection.Close();
oSqlConnection.Dispose();
}
return bReturn;
}
本文地址:http://com.8s8s.com/it/it41294.htm