• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SqlClient.SqlBulkCopy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Data.SqlClient.SqlBulkCopy的典型用法代码示例。如果您正苦于以下问题:C# System.Data.SqlClient.SqlBulkCopy类的具体用法?C# System.Data.SqlClient.SqlBulkCopy怎么用?C# System.Data.SqlClient.SqlBulkCopy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Data.SqlClient.SqlBulkCopy类属于命名空间,在下文中一共展示了System.Data.SqlClient.SqlBulkCopy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.ProductPhoto object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<Nettiers.AdventureWorks.Entities.ProductPhoto> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "ProductPhoto";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("ProductPhotoID", typeof(System.Int32));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("ThumbNailPhoto", typeof(System.Byte[]));
			col1.AllowDBNull = true;		
			DataColumn col2 = dataTable.Columns.Add("ThumbnailPhotoFileName", typeof(System.String));
			col2.AllowDBNull = true;		
			DataColumn col3 = dataTable.Columns.Add("LargePhoto", typeof(System.Byte[]));
			col3.AllowDBNull = true;		
			DataColumn col4 = dataTable.Columns.Add("LargePhotoFileName", typeof(System.String));
			col4.AllowDBNull = true;		
			DataColumn col5 = dataTable.Columns.Add("ModifiedDate", typeof(System.DateTime));
			col5.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("ProductPhotoID", "ProductPhotoID");
			bulkCopy.ColumnMappings.Add("ThumbNailPhoto", "ThumbNailPhoto");
			bulkCopy.ColumnMappings.Add("ThumbnailPhotoFileName", "ThumbnailPhotoFileName");
			bulkCopy.ColumnMappings.Add("LargePhoto", "LargePhoto");
			bulkCopy.ColumnMappings.Add("LargePhotoFileName", "LargePhotoFileName");
			bulkCopy.ColumnMappings.Add("ModifiedDate", "ModifiedDate");
			
			foreach(Nettiers.AdventureWorks.Entities.ProductPhoto entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["ProductPhotoID"] = entity.ProductPhotoId;
							
				
					row["ThumbNailPhoto"] = entity.ThumbNailPhoto;
							
				
					row["ThumbnailPhotoFileName"] = entity.ThumbnailPhotoFileName;
							
				
					row["LargePhoto"] = entity.LargePhoto;
							
				
					row["LargePhotoFileName"] = entity.LargePhotoFileName;
							
				
					row["ModifiedDate"] = entity.ModifiedDate;
							
				
				dataTable.Rows.Add(row);
			}		
			
			// send the data to the server		
			bulkCopy.WriteToServer(dataTable);		
			
			// update back the state
			foreach(Nettiers.AdventureWorks.Entities.ProductPhoto entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
			
				entity.AcceptChanges();
			}
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:90,代码来源:SqlProductPhotoProviderBase.generated.cs


示例2: BulkInsert

        /// <summary>
        /// Lets you efficiently bulk insert many entities to the database.
        /// </summary>
        /// <param name="transactionManager">The transaction manager.</param>
        /// <param name="entities">The entities.</param>
        /// <remarks>
        ///		After inserting into the datasource, the School.Entities.Students object will be updated
        /// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
        /// </remarks>	
        public override void BulkInsert(TransactionManager transactionManager, TList<School.Entities.Students> entities)
        {
            //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);

            System.Data.SqlClient.SqlBulkCopy bulkCopy = null;

            if (transactionManager != null && transactionManager.IsOpen)
            {
                System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
                System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
            }
            else
            {
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
            }

            bulkCopy.BulkCopyTimeout = 360;
            bulkCopy.DestinationTableName = "Students";

            DataTable dataTable = new DataTable();
            DataColumn col0 = dataTable.Columns.Add("Id", typeof(System.Int32));
            col0.AllowDBNull = false;
            DataColumn col1 = dataTable.Columns.Add("Name", typeof(System.String));
            col1.AllowDBNull = false;
            DataColumn col2 = dataTable.Columns.Add("Address", typeof(System.String));
            col2.AllowDBNull = false;
            DataColumn col3 = dataTable.Columns.Add("ClassId", typeof(System.Int32));
            col3.AllowDBNull = false;
            DataColumn col4 = dataTable.Columns.Add("Birthdate", typeof(System.DateTime));
            col4.AllowDBNull = false;
            DataColumn col5 = dataTable.Columns.Add("Gender", typeof(System.String));
            col5.AllowDBNull = false;

            bulkCopy.ColumnMappings.Add("Id", "Id");
            bulkCopy.ColumnMappings.Add("Name", "Name");
            bulkCopy.ColumnMappings.Add("Address", "Address");
            bulkCopy.ColumnMappings.Add("ClassId", "ClassId");
            bulkCopy.ColumnMappings.Add("Birthdate", "Birthdate");
            bulkCopy.ColumnMappings.Add("Gender", "Gender");

            foreach(School.Entities.Students entity in entities)
            {
                if (entity.EntityState != EntityState.Added)
                    continue;

                DataRow row = dataTable.NewRow();

                    row["Id"] = entity.Id;

                    row["Name"] = entity.Name;

                    row["Address"] = entity.Address;

                    row["ClassId"] = entity.ClassId;

                    row["Birthdate"] = entity.Birthdate;

                    row["Gender"] = entity.Gender;

                dataTable.Rows.Add(row);
            }

            // send the data to the server
            bulkCopy.WriteToServer(dataTable);

            // update back the state
            foreach(School.Entities.Students entity in entities)
            {
                if (entity.EntityState != EntityState.Added)
                    continue;

                entity.AcceptChanges();
            }
        }
开发者ID:mario-loza,项目名称:School,代码行数:84,代码来源:SqlStudentsProviderBase.generated.cs


示例3: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.StoreContact object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<Nettiers.AdventureWorks.Entities.StoreContact> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "StoreContact";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("CustomerID", typeof(System.Int32));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("ContactID", typeof(System.Int32));
			col1.AllowDBNull = false;		
			DataColumn col2 = dataTable.Columns.Add("ContactTypeID", typeof(System.Int32));
			col2.AllowDBNull = false;		
			DataColumn col3 = dataTable.Columns.Add("rowguid", typeof(System.Guid));
			col3.AllowDBNull = false;		
			DataColumn col4 = dataTable.Columns.Add("ModifiedDate", typeof(System.DateTime));
			col4.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("CustomerID", "CustomerID");
			bulkCopy.ColumnMappings.Add("ContactID", "ContactID");
			bulkCopy.ColumnMappings.Add("ContactTypeID", "ContactTypeID");
			bulkCopy.ColumnMappings.Add("rowguid", "rowguid");
			bulkCopy.ColumnMappings.Add("ModifiedDate", "ModifiedDate");
			
			foreach(Nettiers.AdventureWorks.Entities.StoreContact entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["CustomerID"] = entity.CustomerId;
							
				
					row["ContactID"] = entity.ContactId;
							
				
					row["ContactTypeID"] = entity.ContactTypeId;
							
				
					row["rowguid"] = entity.Rowguid;
							
				
					row["ModifiedDate"] = entity.ModifiedDate;
							
				
				dataTable.Rows.Add(row);
			}		
			
			// send the data to the server		
			bulkCopy.WriteToServer(dataTable);		
			
			// update back the state
			foreach(Nettiers.AdventureWorks.Entities.StoreContact entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
			
				entity.AcceptChanges();
			}
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:84,代码来源:SqlStoreContactProviderBase.generated.cs


示例4: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the ClinicDoctor.Entities.Appointment object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<ClinicDoctor.Entities.Appointment> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "Appointment";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("Id", typeof(System.String));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("CustomerId", typeof(System.String));
			col1.AllowDBNull = false;		
			DataColumn col2 = dataTable.Columns.Add("CustomerName", typeof(System.String));
			col2.AllowDBNull = true;		
			DataColumn col3 = dataTable.Columns.Add("ContentId", typeof(System.Int64));
			col3.AllowDBNull = true;		
			DataColumn col4 = dataTable.Columns.Add("ContentTitle", typeof(System.String));
			col4.AllowDBNull = true;		
			DataColumn col5 = dataTable.Columns.Add("DoctorUsername", typeof(System.String));
			col5.AllowDBNull = true;		
			DataColumn col6 = dataTable.Columns.Add("DoctorShortName", typeof(System.String));
			col6.AllowDBNull = true;		
			DataColumn col7 = dataTable.Columns.Add("DoctorEmail", typeof(System.String));
			col7.AllowDBNull = true;		
			DataColumn col8 = dataTable.Columns.Add("RoomId", typeof(System.Int64));
			col8.AllowDBNull = true;		
			DataColumn col9 = dataTable.Columns.Add("RoomTitle", typeof(System.String));
			col9.AllowDBNull = true;		
			DataColumn col10 = dataTable.Columns.Add("NurseUsername", typeof(System.String));
			col10.AllowDBNull = true;		
			DataColumn col11 = dataTable.Columns.Add("NurseShortName", typeof(System.String));
			col11.AllowDBNull = true;		
			DataColumn col12 = dataTable.Columns.Add("StatusId", typeof(System.Int64));
			col12.AllowDBNull = true;		
			DataColumn col13 = dataTable.Columns.Add("StatusTitle", typeof(System.String));
			col13.AllowDBNull = true;		
			DataColumn col14 = dataTable.Columns.Add("Note", typeof(System.String));
			col14.AllowDBNull = true;		
			DataColumn col15 = dataTable.Columns.Add("StartTime", typeof(System.DateTime));
			col15.AllowDBNull = true;		
			DataColumn col16 = dataTable.Columns.Add("EndTime", typeof(System.DateTime));
			col16.AllowDBNull = true;		
			DataColumn col17 = dataTable.Columns.Add("ColorCode", typeof(System.String));
			col17.AllowDBNull = false;		
			DataColumn col18 = dataTable.Columns.Add("IsComplete", typeof(System.Boolean));
			col18.AllowDBNull = false;		
			DataColumn col19 = dataTable.Columns.Add("IsDisabled", typeof(System.Boolean));
			col19.AllowDBNull = false;		
			DataColumn col20 = dataTable.Columns.Add("CreateUser", typeof(System.String));
			col20.AllowDBNull = true;		
			DataColumn col21 = dataTable.Columns.Add("CreateDate", typeof(System.DateTime));
			col21.AllowDBNull = false;		
			DataColumn col22 = dataTable.Columns.Add("UpdateUser", typeof(System.String));
			col22.AllowDBNull = true;		
			DataColumn col23 = dataTable.Columns.Add("UpdateDate", typeof(System.DateTime));
			col23.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("Id", "Id");
			bulkCopy.ColumnMappings.Add("CustomerId", "CustomerId");
			bulkCopy.ColumnMappings.Add("CustomerName", "CustomerName");
			bulkCopy.ColumnMappings.Add("ContentId", "ContentId");
			bulkCopy.ColumnMappings.Add("ContentTitle", "ContentTitle");
			bulkCopy.ColumnMappings.Add("DoctorUsername", "DoctorUsername");
			bulkCopy.ColumnMappings.Add("DoctorShortName", "DoctorShortName");
			bulkCopy.ColumnMappings.Add("DoctorEmail", "DoctorEmail");
			bulkCopy.ColumnMappings.Add("RoomId", "RoomId");
			bulkCopy.ColumnMappings.Add("RoomTitle", "RoomTitle");
			bulkCopy.ColumnMappings.Add("NurseUsername", "NurseUsername");
			bulkCopy.ColumnMappings.Add("NurseShortName", "NurseShortName");
			bulkCopy.ColumnMappings.Add("StatusId", "StatusId");
			bulkCopy.ColumnMappings.Add("StatusTitle", "StatusTitle");
			bulkCopy.ColumnMappings.Add("Note", "Note");
			bulkCopy.ColumnMappings.Add("StartTime", "StartTime");
			bulkCopy.ColumnMappings.Add("EndTime", "EndTime");
			bulkCopy.ColumnMappings.Add("ColorCode", "ColorCode");
			bulkCopy.ColumnMappings.Add("IsComplete", "IsComplete");
			bulkCopy.ColumnMappings.Add("IsDisabled", "IsDisabled");
			bulkCopy.ColumnMappings.Add("CreateUser", "CreateUser");
//.........这里部分代码省略.........
开发者ID:williams55,项目名称:clinic-doctor,代码行数:101,代码来源:SqlAppointmentProviderBase.generated.cs


示例5: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the PetShop.Business.Orders object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<PetShop.Business.Orders> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "Orders";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("OrderId", typeof(int));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("UserId", typeof(string));
			col1.AllowDBNull = false;		
			DataColumn col2 = dataTable.Columns.Add("OrderDate", typeof(System.DateTime));
			col2.AllowDBNull = false;		
			DataColumn col3 = dataTable.Columns.Add("ShipAddr1", typeof(string));
			col3.AllowDBNull = false;		
			DataColumn col4 = dataTable.Columns.Add("ShipAddr2", typeof(string));
			col4.AllowDBNull = true;		
			DataColumn col5 = dataTable.Columns.Add("ShipCity", typeof(string));
			col5.AllowDBNull = false;		
			DataColumn col6 = dataTable.Columns.Add("ShipState", typeof(string));
			col6.AllowDBNull = false;		
			DataColumn col7 = dataTable.Columns.Add("ShipZip", typeof(string));
			col7.AllowDBNull = false;		
			DataColumn col8 = dataTable.Columns.Add("ShipCountry", typeof(string));
			col8.AllowDBNull = false;		
			DataColumn col9 = dataTable.Columns.Add("BillAddr1", typeof(string));
			col9.AllowDBNull = false;		
			DataColumn col10 = dataTable.Columns.Add("BillAddr2", typeof(string));
			col10.AllowDBNull = true;		
			DataColumn col11 = dataTable.Columns.Add("BillCity", typeof(string));
			col11.AllowDBNull = false;		
			DataColumn col12 = dataTable.Columns.Add("BillState", typeof(string));
			col12.AllowDBNull = false;		
			DataColumn col13 = dataTable.Columns.Add("BillZip", typeof(string));
			col13.AllowDBNull = false;		
			DataColumn col14 = dataTable.Columns.Add("BillCountry", typeof(string));
			col14.AllowDBNull = false;		
			DataColumn col15 = dataTable.Columns.Add("Courier", typeof(string));
			col15.AllowDBNull = false;		
			DataColumn col16 = dataTable.Columns.Add("TotalPrice", typeof(decimal));
			col16.AllowDBNull = false;		
			DataColumn col17 = dataTable.Columns.Add("BillToFirstName", typeof(string));
			col17.AllowDBNull = false;		
			DataColumn col18 = dataTable.Columns.Add("BillToLastName", typeof(string));
			col18.AllowDBNull = false;		
			DataColumn col19 = dataTable.Columns.Add("ShipToFirstName", typeof(string));
			col19.AllowDBNull = false;		
			DataColumn col20 = dataTable.Columns.Add("ShipToLastName", typeof(string));
			col20.AllowDBNull = false;		
			DataColumn col21 = dataTable.Columns.Add("AuthorizationNumber", typeof(int));
			col21.AllowDBNull = false;		
			DataColumn col22 = dataTable.Columns.Add("Locale", typeof(string));
			col22.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("OrderId", "OrderId");
			bulkCopy.ColumnMappings.Add("UserId", "UserId");
			bulkCopy.ColumnMappings.Add("OrderDate", "OrderDate");
			bulkCopy.ColumnMappings.Add("ShipAddr1", "ShipAddr1");
			bulkCopy.ColumnMappings.Add("ShipAddr2", "ShipAddr2");
			bulkCopy.ColumnMappings.Add("ShipCity", "ShipCity");
			bulkCopy.ColumnMappings.Add("ShipState", "ShipState");
			bulkCopy.ColumnMappings.Add("ShipZip", "ShipZip");
			bulkCopy.ColumnMappings.Add("ShipCountry", "ShipCountry");
			bulkCopy.ColumnMappings.Add("BillAddr1", "BillAddr1");
			bulkCopy.ColumnMappings.Add("BillAddr2", "BillAddr2");
			bulkCopy.ColumnMappings.Add("BillCity", "BillCity");
			bulkCopy.ColumnMappings.Add("BillState", "BillState");
			bulkCopy.ColumnMappings.Add("BillZip", "BillZip");
			bulkCopy.ColumnMappings.Add("BillCountry", "BillCountry");
			bulkCopy.ColumnMappings.Add("Courier", "Courier");
			bulkCopy.ColumnMappings.Add("TotalPrice", "TotalPrice");
			bulkCopy.ColumnMappings.Add("BillToFirstName", "BillToFirstName");
			bulkCopy.ColumnMappings.Add("BillToLastName", "BillToLastName");
			bulkCopy.ColumnMappings.Add("ShipToFirstName", "ShipToFirstName");
			bulkCopy.ColumnMappings.Add("ShipToLastName", "ShipToLastName");
			bulkCopy.ColumnMappings.Add("AuthorizationNumber", "AuthorizationNumber");
			bulkCopy.ColumnMappings.Add("Locale", "Locale");
//.........这里部分代码省略.........
开发者ID:netTiers,项目名称:netTiers,代码行数:101,代码来源:SqlOrdersProviderBase.generated.cs


示例6: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.TimestampPk object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<Nettiers.AdventureWorks.Entities.TimestampPk> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "TimestampPK";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("TimestampPK", typeof(System.Byte[]));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("SomeText", typeof(System.String));
			col1.AllowDBNull = true;		
			
			bulkCopy.ColumnMappings.Add("TimestampPK", "TimestampPK");
			bulkCopy.ColumnMappings.Add("SomeText", "SomeText");
			
			foreach(Nettiers.AdventureWorks.Entities.TimestampPk entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["TimestampPK"] = entity.TimestampPk;
							
				
					row["SomeText"] = entity.SomeText;
							
				
				dataTable.Rows.Add(row);
			}		
			
			// send the data to the server		
			bulkCopy.WriteToServer(dataTable);		
			
			// update back the state
			foreach(Nettiers.AdventureWorks.Entities.TimestampPk entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
			
				entity.AcceptChanges();
			}
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:66,代码来源:SqlTimestampPkProviderBase.generated.cs


示例7: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.SalesPerson object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<Nettiers.AdventureWorks.Entities.SalesPerson> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "SalesPerson";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("SalesPersonID", typeof(System.Int32));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("TerritoryID", typeof(System.Int32));
			col1.AllowDBNull = true;		
			DataColumn col2 = dataTable.Columns.Add("SalesQuota", typeof(System.Decimal));
			col2.AllowDBNull = true;		
			DataColumn col3 = dataTable.Columns.Add("Bonus", typeof(System.Decimal));
			col3.AllowDBNull = false;		
			DataColumn col4 = dataTable.Columns.Add("CommissionPct", typeof(System.Decimal));
			col4.AllowDBNull = false;		
			DataColumn col5 = dataTable.Columns.Add("SalesYTD", typeof(System.Decimal));
			col5.AllowDBNull = false;		
			DataColumn col6 = dataTable.Columns.Add("SalesLastYear", typeof(System.Decimal));
			col6.AllowDBNull = false;		
			DataColumn col7 = dataTable.Columns.Add("rowguid", typeof(System.Guid));
			col7.AllowDBNull = false;		
			DataColumn col8 = dataTable.Columns.Add("ModifiedDate", typeof(System.DateTime));
			col8.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("SalesPersonID", "SalesPersonID");
			bulkCopy.ColumnMappings.Add("TerritoryID", "TerritoryID");
			bulkCopy.ColumnMappings.Add("SalesQuota", "SalesQuota");
			bulkCopy.ColumnMappings.Add("Bonus", "Bonus");
			bulkCopy.ColumnMappings.Add("CommissionPct", "CommissionPct");
			bulkCopy.ColumnMappings.Add("SalesYTD", "SalesYTD");
			bulkCopy.ColumnMappings.Add("SalesLastYear", "SalesLastYear");
			bulkCopy.ColumnMappings.Add("rowguid", "rowguid");
			bulkCopy.ColumnMappings.Add("ModifiedDate", "ModifiedDate");
			
			foreach(Nettiers.AdventureWorks.Entities.SalesPerson entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["SalesPersonID"] = entity.SalesPersonId;
							
				
					row["TerritoryID"] = entity.TerritoryId.HasValue ? (object) entity.TerritoryId  : System.DBNull.Value;
							
				
					row["SalesQuota"] = entity.SalesQuota.HasValue ? (object) entity.SalesQuota  : System.DBNull.Value;
							
				
					row["Bonus"] = entity.Bonus;
							
				
					row["CommissionPct"] = entity.CommissionPct;
							
				
					row["SalesYTD"] = entity.SalesYtd;
							
				
					row["SalesLastYear"] = entity.SalesLastYear;
							
				
					row["rowguid"] = entity.Rowguid;
							
				
					row["ModifiedDate"] = entity.ModifiedDate;
							
				
				dataTable.Rows.Add(row);
			}		
			
			// send the data to the server		
			bulkCopy.WriteToServer(dataTable);		
			
			// update back the state
//.........这里部分代码省略.........
开发者ID:WildGenie,项目名称:NetTiers,代码行数:101,代码来源:SqlSalesPersonProviderBase.generated.cs


示例8: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the ClinicDoctor.Entities.Staff object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<ClinicDoctor.Entities.Staff> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "Staff";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("Id", typeof(System.Int64));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("FirstName", typeof(System.String));
			col1.AllowDBNull = false;		
			DataColumn col2 = dataTable.Columns.Add("LastName", typeof(System.String));
			col2.AllowDBNull = false;		
			DataColumn col3 = dataTable.Columns.Add("ShortName", typeof(System.String));
			col3.AllowDBNull = false;		
			DataColumn col4 = dataTable.Columns.Add("UserName", typeof(System.String));
			col4.AllowDBNull = false;		
			DataColumn col5 = dataTable.Columns.Add("Email", typeof(System.String));
			col5.AllowDBNull = true;		
			DataColumn col6 = dataTable.Columns.Add("Address", typeof(System.String));
			col6.AllowDBNull = true;		
			DataColumn col7 = dataTable.Columns.Add("HomePhone", typeof(System.String));
			col7.AllowDBNull = true;		
			DataColumn col8 = dataTable.Columns.Add("WorkPhone", typeof(System.String));
			col8.AllowDBNull = true;		
			DataColumn col9 = dataTable.Columns.Add("CellPhone", typeof(System.String));
			col9.AllowDBNull = true;		
			DataColumn col10 = dataTable.Columns.Add("Birthdate", typeof(System.DateTime));
			col10.AllowDBNull = true;		
			DataColumn col11 = dataTable.Columns.Add("IsFemale", typeof(System.Boolean));
			col11.AllowDBNull = false;		
			DataColumn col12 = dataTable.Columns.Add("Title", typeof(System.String));
			col12.AllowDBNull = true;		
			DataColumn col13 = dataTable.Columns.Add("Note", typeof(System.String));
			col13.AllowDBNull = true;		
			DataColumn col14 = dataTable.Columns.Add("Roles", typeof(System.String));
			col14.AllowDBNull = false;		
			DataColumn col15 = dataTable.Columns.Add("IsDisabled", typeof(System.Boolean));
			col15.AllowDBNull = false;		
			DataColumn col16 = dataTable.Columns.Add("CreateUser", typeof(System.String));
			col16.AllowDBNull = true;		
			DataColumn col17 = dataTable.Columns.Add("CreateDate", typeof(System.DateTime));
			col17.AllowDBNull = false;		
			DataColumn col18 = dataTable.Columns.Add("UpdateUser", typeof(System.String));
			col18.AllowDBNull = true;		
			DataColumn col19 = dataTable.Columns.Add("UpdateDate", typeof(System.DateTime));
			col19.AllowDBNull = false;		
			
			bulkCopy.ColumnMappings.Add("Id", "Id");
			bulkCopy.ColumnMappings.Add("FirstName", "FirstName");
			bulkCopy.ColumnMappings.Add("LastName", "LastName");
			bulkCopy.ColumnMappings.Add("ShortName", "ShortName");
			bulkCopy.ColumnMappings.Add("UserName", "UserName");
			bulkCopy.ColumnMappings.Add("Email", "Email");
			bulkCopy.ColumnMappings.Add("Address", "Address");
			bulkCopy.ColumnMappings.Add("HomePhone", "HomePhone");
			bulkCopy.ColumnMappings.Add("WorkPhone", "WorkPhone");
			bulkCopy.ColumnMappings.Add("CellPhone", "CellPhone");
			bulkCopy.ColumnMappings.Add("Birthdate", "Birthdate");
			bulkCopy.ColumnMappings.Add("IsFemale", "IsFemale");
			bulkCopy.ColumnMappings.Add("Title", "Title");
			bulkCopy.ColumnMappings.Add("Note", "Note");
			bulkCopy.ColumnMappings.Add("Roles", "Roles");
			bulkCopy.ColumnMappings.Add("IsDisabled", "IsDisabled");
			bulkCopy.ColumnMappings.Add("CreateUser", "CreateUser");
			bulkCopy.ColumnMappings.Add("CreateDate", "CreateDate");
			bulkCopy.ColumnMappings.Add("UpdateUser", "UpdateUser");
			bulkCopy.ColumnMappings.Add("UpdateDate", "UpdateDate");
			
			foreach(ClinicDoctor.Entities.Staff entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["Id"] = entity.Id;
//.........这里部分代码省略.........
开发者ID:williams55,项目名称:clinic-doctor,代码行数:101,代码来源:SqlStaffProviderBase.generated.cs


示例9: BulkInsert

        /// <summary>
        /// Lets you efficiently bulk insert many entities to the database.
        /// </summary>
        /// <param name="transactionManager">The transaction manager.</param>
        /// <param name="entities">The entities.</param>
        /// <remarks>
        ///		After inserting into the datasource, the Library.BLL.BookImage object will be updated
        /// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
        /// </remarks>	
        public override void BulkInsert(TransactionManager transactionManager, TList<Library.BLL.BookImage> entities)
        {
            //System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);

            System.Data.SqlClient.SqlBulkCopy bulkCopy = null;

            if (transactionManager != null && transactionManager.IsOpen)
            {
                System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
                System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
            }
            else
            {
                bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
            }

            bulkCopy.BulkCopyTimeout = 360;
            bulkCopy.DestinationTableName = "BookImage";

            DataTable dataTable = new DataTable();
            DataColumn col0 = dataTable.Columns.Add("ID", typeof(System.Int32));
            col0.AllowDBNull = false;
            DataColumn col1 = dataTable.Columns.Add("Name", typeof(System.String));
            col1.AllowDBNull = false;
            DataColumn col2 = dataTable.Columns.Add("Format", typeof(System.String));
            col2.AllowDBNull = true;
            DataColumn col3 = dataTable.Columns.Add("Size", typeof(System.String));
            col3.AllowDBNull = true;
            DataColumn col4 = dataTable.Columns.Add("Link", typeof(System.String));
            col4.AllowDBNull = true;
            DataColumn col5 = dataTable.Columns.Add("IsAvailable", typeof(System.String));
            col5.AllowDBNull = true;

            bulkCopy.ColumnMappings.Add("ID", "ID");
            bulkCopy.ColumnMappings.Add("Name", "Name");
            bulkCopy.ColumnMappings.Add("Format", "Format");
            bulkCopy.ColumnMappings.Add("Size", "Size");
            bulkCopy.ColumnMappings.Add("Link", "Link");
            bulkCopy.ColumnMappings.Add("IsAvailable", "IsAvailable");

            foreach(Library.BLL.BookImage entity in entities)
            {
                if (entity.EntityState != EntityState.Added)
                    continue;

                DataRow row = dataTable.NewRow();

                    row["ID"] = entity.ID;

                    row["Name"] = entity.Name;

                    row["Format"] = entity.Format;

                    row["Size"] = entity.Size;

                    row["Link"] = entity.Link;

                    row["IsAvailable"] = entity.IsAvailable;

                dataTable.Rows.Add(row);
            }

            // send the data to the server
            bulkCopy.WriteToServer(dataTable);

            // update back the state
            foreach(Library.BLL.BookImage entity in entities)
            {
                if (entity.EntityState != EntityState.Added)
                    continue;

                entity.AcceptChanges();
            }
        }
开发者ID:YasienDwieb,项目名称:Library,代码行数:84,代码来源:SqlBookImageProviderBase.generated.cs


示例10: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the PetShop.Business.Supplier object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<PetShop.Business.Supplier> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "Supplier";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("SuppId", typeof(int));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("Name", typeof(string));
			col1.AllowDBNull = true;		
			DataColumn col2 = dataTable.Columns.Add("Status", typeof(string));
			col2.AllowDBNull = false;		
			DataColumn col3 = dataTable.Columns.Add("Addr1", typeof(string));
			col3.AllowDBNull = true;		
			DataColumn col4 = dataTable.Columns.Add("Addr2", typeof(string));
			col4.AllowDBNull = true;		
			DataColumn col5 = dataTable.Columns.Add("City", typeof(string));
			col5.AllowDBNull = true;		
			DataColumn col6 = dataTable.Columns.Add("State", typeof(string));
			col6.AllowDBNull = true;		
			DataColumn col7 = dataTable.Columns.Add("Zip", typeof(string));
			col7.AllowDBNull = true;		
			DataColumn col8 = dataTable.Columns.Add("Phone", typeof(string));
			col8.AllowDBNull = true;		
			
			bulkCopy.ColumnMappings.Add("SuppId", "SuppId");
			bulkCopy.ColumnMappings.Add("Name", "Name");
			bulkCopy.ColumnMappings.Add("Status", "Status");
			bulkCopy.ColumnMappings.Add("Addr1", "Addr1");
			bulkCopy.ColumnMappings.Add("Addr2", "Addr2");
			bulkCopy.ColumnMappings.Add("City", "City");
			bulkCopy.ColumnMappings.Add("State", "State");
			bulkCopy.ColumnMappings.Add("Zip", "Zip");
			bulkCopy.ColumnMappings.Add("Phone", "Phone");
			
			foreach(PetShop.Business.Supplier entity in entities)
			{
				if (entity.EntityState != EntityState.Added)
					continue;
					
				DataRow row = dataTable.NewRow();
				
					row["SuppId"] = entity.SuppId;
							
				
					row["Name"] = entity.Name;
							
				
					row["Status"] = entity.Status;
							
				
					row["Addr1"] = entity.Addr1;
							
				
					row["Addr2"] = entity.Addr2;
							
				
					row["City"] = entity.City;
							
				
					row["State"] = entity.State;
							
				
					row["Zip"] = entity.Zip;
							
				
					row["Phone"] = entity.Phone;
							
				
				dataTable.Rows.Add(row);
			}		
			
			// send the data to the server		
			bulkCopy.WriteToServer(dataTable);		
			
			// update back the state
//.........这里部分代码省略.........
开发者ID:netTiers,项目名称:netTiers,代码行数:101,代码来源:SqlSupplierProviderBase.generated.cs


示例11: BulkInsert

		/// <summary>
		/// Lets you efficiently bulk insert many entities to the database.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entities">The entities.</param>
		/// <remarks>
		///		After inserting into the datasource, the Nettiers.AdventureWorks.Entities.DatabaseLog object will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>	
		public override void BulkInsert(TransactionManager transactionManager, TList<Nettiers.AdventureWorks.Entities.DatabaseLog> entities)
		{
			//System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			
			System.Data.SqlClient.SqlBulkCopy bulkCopy = null;
	
			if (transactionManager != null && transactionManager.IsOpen)
			{			
				System.Data.SqlClient.SqlConnection cnx = transactionManager.TransactionObject.Connection as System.Data.SqlClient.SqlConnection;
				System.Data.SqlClient.SqlTransaction transaction = transactionManager.TransactionObject as System.Data.SqlClient.SqlTransaction;
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(cnx, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints, transaction); //, null);
			}
			else
			{
				bulkCopy = new System.Data.SqlClient.SqlBulkCopy(this._connectionString, System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints); //, null);
			}
			
			bulkCopy.BulkCopyTimeout = 360;
			bulkCopy.DestinationTableName = "DatabaseLog";
			
			DataTable dataTable = new DataTable();
			DataColumn col0 = dataTable.Columns.Add("DatabaseLogID", typeof(System.Int32));
			col0.AllowDBNull = false;		
			DataColumn col1 = dataTable.Columns.Add("PostTime", typeof(System.DateTime));
			col1.AllowDBNull = false;		
			DataColumn col2 = dataTable.Columns.Add("DatabaseUser", typeof(System.String));
			col2.AllowDBNull = false;		
			DataColumn col3 = dataTable.Columns.Add("Event", typeof(System.String));
			col3.AllowDBNull = false;		
			DataColumn col4 = dataTable.Columns.Add("Schema", typeof( 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SqlClient.SqlCommand类代码示例发布时间:2022-05-24
下一篇:
C# SQLite.SQLiteConnection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap