本文整理汇总了C#中DAL.TestSqlServerConnectionString方法的典型用法代码示例。如果您正苦于以下问题:C# DAL.TestSqlServerConnectionString方法的具体用法?C# DAL.TestSqlServerConnectionString怎么用?C# DAL.TestSqlServerConnectionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAL
的用法示例。
在下文中一共展示了DAL.TestSqlServerConnectionString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
DateTime runTime = DateTime.Now;
DAL dal = new DAL(ConfigurationManager.ConnectionStrings["DBServer"].ConnectionString);
Utils.OperationResult canConnectToDB = dal.TestSqlServerConnectionString();
if (canConnectToDB.Success == false)
{
foreach (string msg in canConnectToDB.MessageList)
{
Console.WriteLine(msg);
}
Console.WriteLine("Cannot connect to database.");
Console.WriteLine("Press any key to exit the program.");
Console.ReadLine();
Environment.Exit(0);
}
//List<Login> LoginList = Utils.Utils.GetAllLogins();
List<Login> LoginList = Utils.Utils.GetAllLoginsBypassPrompt();
ServerRecordRepository srepo = new ServerRecordRepository(ConfigurationManager.ConnectionStrings["DBServer"].ConnectionString);
IEnumerable<ServerConnection> ServerList = srepo.GetServerSet();
foreach (ServerConnection srv in ServerList)
{
if (srv.DomainAlias.ToString() == "Domain_O")
{
srepo.GetServerInfo(srv.ServerIP, ServerEnums.Domain.Domain_O, LoginList, runTime);
}
else
{
srepo.GetServerInfo(srv.ServerIP, ServerEnums.Domain.Domain_C, LoginList, runTime);
}
}
}