private static void RunBulkCopy(SchemaType schemaType, bool keepNulls, bool keepKey, IDataReader reader) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); if (keepNulls) { options = options |= SqlCeBulkCopyOptions.KeepNulls; } if (keepKey) { options = options |= SqlCeBulkCopyOptions.KeepIdentity; } using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options)) { bc.DestinationTableName = "tblDoctor"; if (schemaType == SchemaType.DataReaderTestMappedCollectionKeepOriginal) { bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping("Active", "Active")); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping("MiddleName", "MiddleName")); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping("FirstName", "FirstName")); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping(2, "DoctorId")); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping(3, 3)); //LastName bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping(4, 4)); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping("SpecialityId_FK", "SpecialityId_FK")); bc.ColumnMappings.Add(new SqlCeBulkCopyColumnMapping("LastUpdated", "LastUpdated")); } bc.WriteToServer(reader); } sw.Stop(); System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} rows copied in {1} ms, Constrained: {2}, Keep Nulls: {3}", "??", sw.ElapsedMilliseconds, schemaType, keepNulls)); }
public SqlCeBulkCopy(SqlCeConnection connection, SqlCeBulkCopyOptions copyOptions) { conn = connection; options = copyOptions; keepNulls = IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); keepIdentity = IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); }
public string BulkInsert(DataTable x, string local_table) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; using (SqlCeBulkCopy bc = new SqlCeBulkCopy(varSqlConnect, options)) { bc.DestinationTableName = local_table; try { //conn.Open(); bc.WriteToServer(x); } catch (Exception ex) { Cursor.Current = Cursors.Default; return(ex.ToString() + local_table); //clsException.EnableException(ex); } finally { //conn.Close(); } return(null); } }
private static void RunBulkCopy(SchemaType schemaType, bool keepNulls, List <Shippers> testList) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); switch (schemaType) { case SchemaType.FullNoIdentity: break; case SchemaType.NoConstraints: break; case SchemaType.FullConstraints: options = SqlCeBulkCopyOptions.KeepIdentity; break; default: break; } if (keepNulls) { options = options |= SqlCeBulkCopyOptions.KeepNulls; } System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options)) { bc.DestinationTableName = "Shippers"; bc.WriteToServer(testList); } sw.Stop(); System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} rows copied in {1} ms, Constrained: {2}, Keep Nulls: {3}", testList.Count, sw.ElapsedMilliseconds, schemaType, keepNulls)); }
public SqlCeBulkCopy(SqlCeConnection connection, SqlCeBulkCopyOptions copyOptions) { this.conn = connection; this.options = copyOptions; this.keepNulls = this.IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); this.keepIdentity = this.IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); }
public SqlCeBulkCopy(string connectionString, SqlCeBulkCopyOptions copyOptions) { this.conn = new SqlCeConnection(connectionString); this.ownsConnection = true; this.options = copyOptions; this.keepNulls = this.IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); this.keepIdentity = this.IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); }
public SqlCeBulkCopy(string connectionString, SqlCeBulkCopyOptions copyOptions) { conn = new SqlCeConnection(connectionString); ownsConnection = true; options = copyOptions; keepNulls = IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); keepIdentity = IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); }
private void SetOptions(SqlCeBulkCopyOptions options) { _keepNulls = IsCopyOption(SqlCeBulkCopyOptions.KeepNulls, options); _keepIdentity = IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity, options); _ignoreDuplicateErrors = IsCopyOption(SqlCeBulkCopyOptions.IgnoreDuplicateErrors, options); #if PocketPC #else _disableConstraints = IsCopyOption(SqlCeBulkCopyOptions.DisableConstraints, options); #endif }
private StringBuilder WriteOutputToDatabaseSqlCe(List <Row> rows) { StringBuilder sb = new StringBuilder(); DateTime StartTime = DateTime.Now; ExtensionMethods.TraceInformation("Converting to DataTable - " + StartTime.ToString()); DataTable outDataTable = ToDataTable(rows); sb = outDataTable.ToCsvStringBuilder(); DateTime EndTime = DateTime.Now; ExtensionMethods.TraceInformation("Converted - {0}. Time taken: {1}", EndTime, (EndTime - StartTime).ToString()); bool keepNulls = true; SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); if (keepNulls) { options = options |= SqlCeBulkCopyOptions.KeepNulls; } using (SqlCeBulkCopy bulkCopy = new SqlCeBulkCopy(ConnectionStringKey.Value, options)) { bulkCopy.DestinationTableName = DatabaseMap.TargetTableName; foreach (ColumnMapInfo columnMapInfo in DatabaseMap) { if ((!string.IsNullOrEmpty(columnMapInfo.InputColumn)) && (columnMapInfo.InputColumn != ColumnMapInfo.DatabaseDefault)) { SqlCeBulkCopyColumnMapping mapInfo = new SqlCeBulkCopyColumnMapping(columnMapInfo.InputColumn, columnMapInfo.OutputColumn); bulkCopy.ColumnMappings.Add(mapInfo); } } try { bulkCopy.WriteToServer(outDataTable); } catch (Exception ex) { IsErrored = true; ExtensionMethods.TraceError(ex.Message + ". Trying to get more information...!"); _Job.TraceError(GetBulkCopyFailedData(outDataTable, bulkCopy.ColumnMappings)); } finally { if (outDataTable != null) { outDataTable.Dispose(); } } } return(sb); }
public static void AlgStatBulkInsert(APIStatsCurrent stats) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); var reader = new AlgorithmStatDataReader(stats); using (SqlCeBulkCopy bc = new SqlCeBulkCopy(ConfigurationManager.ConnectionStrings["MonDb"].ConnectionString, options)) { bc.DestinationTableName = "AlgorithmStat"; bc.WriteToServer(reader); } }
/// <summary> /// Creates a new instance of the SqlCeBulkCopy class, using the specified connection and options /// </summary> /// <param name="connection"></param> /// <param name="copyOptions"></param> public SqlCeBulkCopy(SqlCeConnection connection, SqlCeBulkCopyOptions copyOptions) { _conn = connection; _sqlCeBulkCopyOptions = copyOptions; _keepNulls = IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); _keepIdentity = IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); #if PocketPC #else _disableConstraints = IsCopyOption(SqlCeBulkCopyOptions.DisableConstraints); #endif }
private void BULK(DataTable dt) { var options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; using (SqlCeBulkCopy bc = new SqlCeBulkCopy(this.cnn, options)) { bc.DestinationTableName = "CatInventario"; bc.WriteToServer(dt); } }
private void BULK(DataTable dt) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; using (SqlCeBulkCopy bc = new SqlCeBulkCopy(this.cnnstr, options)) { bc.DestinationTableName = "CatMaterial"; bc.WriteToServer(dt); } }
/// <summary> /// Initializes a new instance of the SqlCeBulkCopy class, using the specified connection string and options /// </summary> /// <param name="connectionString"></param> /// <param name="copyOptions"></param> public SqlCeBulkCopy(string connectionString, SqlCeBulkCopyOptions copyOptions) { _conn = new SqlCeConnection(connectionString); _ownsConnection = true; _sqlCeBulkCopyOptions = copyOptions; _keepNulls = IsCopyOption(SqlCeBulkCopyOptions.KeepNulls); _keepIdentity = IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity); #if PocketPC #else _disableConstraints = IsCopyOption(SqlCeBulkCopyOptions.DisableConstraints); #endif }
/// <summary> /// The DoBulkCopy /// </summary> /// <param name="keepNulls">The <see cref="bool"/></param> /// <param name="reader">The <see cref="IEnumerable{Maaslar}"/></param> /// <param name="tablo">The <see cref="string"/></param> public static void DoBulkCopy(bool keepNulls, IEnumerable <Maaslar> reader, string tablo) { var options = new SqlCeBulkCopyOptions(); if (keepNulls) { options |= SqlCeBulkCopyOptions.KeepNulls; } using (var bc = new SqlCeBulkCopy(Database.Connection, options)) { bc.DestinationTableName = tablo; bc.WriteToServer(reader); } }
public void Vs() { var sw = new Stopwatch(); sw.Start(); SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); using (SqlCeBulkCopy bc = new SqlCeBulkCopy("Data Source=|DataDirectory|Database1.sdf", options)) { bc.DestinationTableName = "Items"; bc.WriteToServer(Items(1000000), typeof(Item)); } sw.Stop(); Console.WriteLine("bulk insert elapsed {0}ms", sw.Elapsed.TotalMilliseconds); }
private static void transferTableData(SqlCeConnection sourceConnection, SqlCeConnection targetConnection, SqlCeTransaction transaction, string tableName) { using (SqlCeCommand sourceCommand = sourceConnection.CreateCommand()) { sourceCommand.CommandText = "Select * from " + tableName; using (SqlCeDataReader sourceReader = sourceCommand.ExecuteReader()) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; string[] tableNames = { "FirmDetails" }; if (!tableNames.Contains(tableName)) { options |= SqlCeBulkCopyOptions.KeepIdentity; } using (SqlCeBulkCopy bc = new SqlCeBulkCopy(targetConnection, options, transaction)) { bc.DestinationTableName = tableName; bc.WriteToServer((IDataReader)sourceReader); } if (!tableNames.Contains(tableName)) { using (SqlCeCommand command = targetConnection.CreateCommand()) { command.Transaction = transaction; command.CommandText = "SELECT MAX(ID) FROM " + tableName; object value = command.ExecuteScalar(); int id; if (value == null || value == DBNull.Value) { id = 1; } else { id = (int)value; } command.CommandText = "ALTER TABLE " + tableName + " ALTER COLUMN ID IDENTITY (" + (id + 1) + ", 1)"; command.ExecuteNonQuery(); } } } } }
private static void RunBulkCopy(SchemaType schemaType, bool keepNulls, DataTable testTable) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); switch (schemaType) { case SchemaType.FullNoIdentity: break; case SchemaType.NoConstraints: break; case SchemaType.FullConstraints: options = SqlCeBulkCopyOptions.KeepIdentity; break; case SchemaType.FullConstraintsDuplicateRows: options = SqlCeBulkCopyOptions.KeepIdentity; break; } if (keepNulls) { options = options |= SqlCeBulkCopyOptions.KeepNulls; } if (schemaType == SchemaType.FullConstraintsDuplicateRows) { options = options |= SqlCeBulkCopyOptions.IgnoreDuplicateErrors; } var sw = new Stopwatch(); sw.Start(); using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options)) { bc.NotifyAfter = 1000; bc.RowsCopied += new EventHandler <SqlCeRowsCopiedEventArgs>(bc_RowsCopied); bc.DestinationTableName = "Shippers"; bc.WriteToServer(testTable); } sw.Stop(); System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} rows copied in {1} ms, Constrained: {2}, Keep Nulls: {3}", testTable.Rows.Count, sw.ElapsedMilliseconds, schemaType, keepNulls)); }
public static void ProfitStatBulkInsert(IEnumerable <CoinProfit> coinProfitList) { var filteredList = coinProfitList.Where(c => !c.ProfitCount.Equals(double.NaN) && !c.ProfitCountPercent.Equals(double.NaN)); if (filteredList.Count() == 0) { return; } SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); var reader = new ProfitStatDataReader(filteredList); using (SqlCeBulkCopy bc = new SqlCeBulkCopy(ConfigurationManager.ConnectionStrings["MonDb"].ConnectionString, options)) { bc.DestinationTableName = "ProfitStat"; bc.WriteToServer(reader); } }
private void BULK(DataTable dt) { try { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; using (SqlCeBulkCopy bc = new SqlCeBulkCopy(this.cnnstr, options)) { bc.DestinationTableName = "CatMaterial"; bc.WriteToServer(dt); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static int IdentityOrdinal(SqlCeConnection conn, SqlCeBulkCopyOptions copyOption, string tableName) { int ordinal = -1; if (!IsCopyOption(SqlCeBulkCopyOptions.KeepIdentity, copyOption)) { using (SqlCeCommand ordCmd = new SqlCeCommand(string.Format(CultureInfo.InvariantCulture, "SELECT ORDINAL_POSITION FROM information_schema.columns WHERE TABLE_NAME = N'{0}' AND AUTOINC_SEED IS NOT NULL", tableName), conn)) { object val = ordCmd.ExecuteScalar(); if (val != null) { ordinal = (int)val - 1; } } } return(ordinal); }
internal static bool IsCopyOption(SqlCeBulkCopyOptions options, SqlCeBulkCopyOptions copyOption) { return((options & copyOption) == options); }
private bool IsCopyOption(SqlCeBulkCopyOptions copyOption) { return((_sqlCeBulkCopyOptions & copyOption) == copyOption); }
private void DoBulkCopy(SqlCeConnection connection, IDataReader reader) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connection, options)) { bc.DestinationTableName = "Coverage"; bc.WriteToServer(reader); } }
private string GetBulkCopyFailedData(DataTable table, SqlCeBulkCopyColumnMappingCollection columnMappings) { StringBuilder errorMessage = new StringBuilder("Bulk copy failures:" + Environment.NewLine); SqlCeConnection connection = null; SqlCeTransaction transaction = null; SqlCeBulkCopy bulkCopy = null; try { connection = new SqlCeConnection(ConnectionStringKey.Value); connection.Open(); transaction = connection.BeginTransaction(); SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options = options |= SqlCeBulkCopyOptions.KeepNulls; bulkCopy = new SqlCeBulkCopy(connection, options, transaction); bulkCopy.DestinationTableName = DatabaseMap.TargetTableName; foreach (SqlCeBulkCopyColumnMapping mapping in columnMappings) { bulkCopy.ColumnMappings.Add(mapping); } DataTable oneRecordTable = table.Clone(); foreach (DataRow row in table.Rows) { oneRecordTable.Rows.Clear(); oneRecordTable.ImportRow(row); try { bulkCopy.WriteToServer(oneRecordTable); } catch (Exception ex) { DataRow faultyDataRow = oneRecordTable.Rows[0]; errorMessage.AppendFormat("Error: {0}{1}", ex.Message, Environment.NewLine); errorMessage.AppendFormat("Row data: {0}", Environment.NewLine); foreach (DataColumn column in oneRecordTable.Columns) { errorMessage.AppendFormat( "\tColumn {0} - [{1}]{2}", column.ColumnName, faultyDataRow[column.ColumnName].ToString(), Environment.NewLine); } } } } catch (Exception ex) { errorMessage.Append("Unable to document SqlBulkCopy errors. See inner exceptions for details."); errorMessage.Append(ex.ToString()); } finally { if (transaction != null) { transaction.Rollback(); } if (connection.State != ConnectionState.Closed) { connection.Close(); } } return(errorMessage.ToString()); }
internal List <KeyValuePair <int, int> > ValidateCollection(SqlCeConnection conn, ISqlCeBulkCopyInsertAdapter adapter, SqlCeBulkCopyOptions copyOptions, string tableName) { if (Count > 0) { var retVal = new List <KeyValuePair <int, int> >(); var sourceColumns = GetSourceColumns(adapter); var destColumns = ToColumnNames(DestinationTableDefaultMetadata.GetDataForTable(conn, tableName)); foreach (SqlCeBulkCopyColumnMapping mapping in this.Items) { var sourceColumnName = (mapping.SourceColumn ?? string.Empty).ToUpper(); var destColumnName = (mapping.DestinationColumn ?? string.Empty).ToUpper(); int sourceIndex = -1; int destIndex = -1; //verify if we have a source column name that it exists if (!string.IsNullOrEmpty(sourceColumnName)) { if (!sourceColumns.Contains(sourceColumnName)) { throw new ApplicationException("No column exists with the name of " + mapping.SourceColumn + " in source."); //use collection name for error since it has original casing. } sourceIndex = sourceColumns.IndexOf(sourceColumnName); } else { if (mapping.SourceOrdinal < 0 || mapping.SourceOrdinal >= destColumns.Count) { throw new ApplicationException("No column exists at index " + mapping.SourceOrdinal + " in source."); //use collection name for error since it has original casing. } sourceIndex = mapping.SourceOrdinal; } if (!string.IsNullOrEmpty(destColumnName)) { if (destColumnName.StartsWith("[") && destColumnName.EndsWith("]")) { destColumnName = destColumnName.Substring(1, destColumnName.Length - 2); } if (!sourceColumns.Contains(destColumnName)) { string bestFit = null; foreach (var existingColumn in destColumns) { if (String.Equals(existingColumn, destColumnName, StringComparison.InvariantCultureIgnoreCase)) { bestFit = existingColumn; } } if (bestFit == null) { throw new ApplicationException("Destination column " + mapping.DestinationColumn + " does not exist in destination table " + tableName + " in database " + conn.Database + "."); //use collection name for error since it has original casing. } else { throw new ApplicationException( "Destination column " + mapping.DestinationColumn + " does not exist in destination table " + tableName + " in database " + conn.Database + "." + " Column name mappings are case specific and best found match is " + bestFit + "."); //use collection name for error since it has original casing. } } else { destIndex = destColumns.IndexOf(destColumnName); } } else { if (mapping.DestinationOrdinal < 0 || mapping.DestinationOrdinal >= destColumns.Count) { throw new ApplicationException( "No column exists at index " + mapping.DestinationOrdinal + " in destination table " + tableName + "in database " + conn.Database + "."); //use collection name for error since it has original casing. } destIndex = mapping.DestinationOrdinal; } retVal.Add(new KeyValuePair <int, int>(sourceIndex, destIndex)); } retVal.Sort((a, b) => { return(a.Key.CompareTo(b.Key)); }); return(retVal); } else { return(Create(conn, adapter, copyOptions, tableName)); } }
internal static List <KeyValuePair <int, int> > Create(SqlCeConnection conn, ISqlCeBulkCopyInsertAdapter adapter, SqlCeBulkCopyOptions copyOptions, string tableName) { var keepNulls = SqlCeBulkCopyTableHelpers.IsCopyOption(SqlCeBulkCopyOptions.KeepNulls, copyOptions); var retVal = new List <KeyValuePair <int, int> >(); //we use this to determine if we throw an error while building maps. int idOrdinal = SqlCeBulkCopyTableHelpers.IdentityOrdinalIgnoreOptions(conn, tableName); var destColumnData = DestinationTableDefaultMetadata.GetDataForTable(conn, tableName); //we are going to validate all of the columns but if we don't map then we will not set the HasMappings //A map is defined as //1. any column that the column order is changed //2. field exists in the dest but not the source and the dest has a default. //3. Identity column that is not 0 ?? we may be able to remove this one. //we only really care about the destination columns being mapped. If too many columns exist do we really care???? var sourceColumns = GetSourceColumns(adapter); for (int destIndex = 0; destIndex < destColumnData.Count; destIndex++) { var destColumn = destColumnData[destIndex]; var sourceIndex = sourceColumns.IndexOf(destColumn.ColumnName); //see if the source is the same as the destination ordinal //if (destIndex != sourceIndex) //we have a map if we care later //If the source index is -1 and the dest does not allow nulls or has a default, it is an error if (sourceIndex < 0) { //either we allow nulls or the ordinal is the index and therefore it is valid if (!destColumnData[destIndex].HasDefault && ((!destColumnData[destIndex].IsNullable && !keepNulls) && idOrdinal != destIndex)) { //var error = destColumnData[destIndex].HasDefault + " " + destColumnData[destIndex].IsNullable + " " + keepNulls + " " + idOrdinal + " " + destIndex; throw new ApplicationException(string.Format("Source column '{0}' does not exist and destination does not allow nulls.", destColumn.ColumnName)); } } retVal.Add(new KeyValuePair <int, int>(sourceIndex, destIndex)); } return(retVal); }
/// <summary> /// Creates a new instance of the SqlCeBulkCopy class, using the specified connection and options /// </summary> /// <param name="connection"></param> /// <param name="copyOptions"></param> public SqlCeBulkCopy(SqlCeConnection connection, SqlCeBulkCopyOptions copyOptions) { _conn = connection; SetOptions(copyOptions); }
private static void BeatmapCreated(object sender, FileSystemEventArgs e) { SqlCeBulkCopyOptions options = new SqlCeBulkCopyOptions(); options |= SqlCeBulkCopyOptions.KeepNulls; using (SqlCeConnection conn = DBHelper.CreateDBConnection()) { conn.Open(); using (SqlCeBulkCopy bC = new SqlCeBulkCopy(conn, options)) { string beatmapHash = MD5FromFile(e.FullPath); if (!DBHelper.RecordExists(conn, "Beatmaps", "Hash", beatmapHash)) { //Remove old record if it exists if (DBHelper.RecordExists(conn, "Beatmaps", "Filename", e.FullPath)) DBHelper.DeleteRecords(conn, "Beatmaps", "Filename", e.FullPath); DataTable dT = DBHelper.CreateBeatmapDataTable(); dT.Rows.Add(beatmapHash, e.FullPath); DBHelper.Insert(bC, dT); } } } }
/// <summary> /// Initializes a new instance of the SqlCeBulkCopy class, using the specified connection, transaction and options. /// </summary> /// <param name="connection"></param> /// <param name="transaction"></param> /// <param name="copyOptions"></param> public SqlCeBulkCopy(SqlCeConnection connection, SqlCeBulkCopyOptions copyOptions, SqlCeTransaction transaction) { _conn = connection; _trans = transaction; SetOptions(copyOptions); }
private bool IsCopyOption(SqlCeBulkCopyOptions copyOption, SqlCeBulkCopyOptions options) { return((options & copyOption) == copyOption); }
/// <summary> /// Initializes a new instance of the SqlCeBulkCopy class, using the specified connection string and options /// </summary> /// <param name="connectionString"></param> /// <param name="copyOptions"></param> public SqlCeBulkCopy(string connectionString, SqlCeBulkCopyOptions copyOptions) { _conn = new SqlCeConnection(connectionString); _ownsConnection = true; SetOptions(copyOptions); }