本文整理汇总了C#中System.Data.SqlClient.SqlConnection.CloseConnection方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnection.CloseConnection方法的具体用法?C# SqlConnection.CloseConnection怎么用?C# SqlConnection.CloseConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlConnection
的用法示例。
在下文中一共展示了SqlConnection.CloseConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//.........这里部分代码省略.........
{
//Logging.PushInfo(query);
command.ExecuteNonQuery();
}
}
}
else if (createStatus == MembershipCreateStatus.DuplicateEmail ||
createStatus == MembershipCreateStatus.DuplicateUserName)
{
//listEmailDuplicate.Add("'" + userAdapt.Email + "'");
}
}
}
}
if (desConn.State == ConnectionState.Open)
{
desConn.Close();
desConn.Dispose();
}
//insert query to queue table
Logging.PushInfo("===============Start Insert Query To Queue Table===================");
Logging.PushInfo("Enable identity insert on table [SysproMigration].[dbo].[QueueMigrate]");
var migrationConn1 = MigrationConnectionString.CreateAndOpenConnection("Syspro Migration");
var enableIdentityInsert = new SqlCommand("SET IDENTITY_INSERT [SysproMigration].[dbo].[QueueMigrate] ON", migrationConn1);
enableIdentityInsert.ExecuteNonQuery();
migrationConn1.CloseConnection();
foreach (var fieldsMap in FieldsMaps)
{
InsertQueryToQueue(fieldsMap, MigrationConnectionString);
}
Logging.PushInfo("===============End Insert Query To Queue Table===================");
Logging.PushInfo("===============Start Read Query from Query Table===================");
var migrationConn = MigrationConnectionString.CreateAndOpenConnection("Syspro Migration");
var sourceConnObject = SourceConnectionString.GetObjectConnection();
var desConnObject = DestinationConnectionString.GetObjectConnection();
var objectQueue = new QueueMigrate
{
SourceServerName = sourceConnObject.DataSource,
SourceDatabaseCompany = sourceConnObject.InitialCatalog,
TargetServerName = desConnObject.DataSource,
TargetDatabaseCompany = desConnObject.InitialCatalog
};
var lstQueue = Utils.GetQueueMigrates(migrationConn, objectQueue);
migrationConn.CloseConnection();
foreach (var queue in lstQueue)
{
var fieldmap = FieldsMaps.FirstOrDefault(t => t.Id == queue.FieldsMapId);
MigrateFromQueue(queue, fieldmap);