// 测试数据库链接
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;
}