How do I make SqlBulkCopy work with MS Enterprise Library? -
I have some code that uses SqlBulkCopy and now we use the Enterprise Library database function instead of the standard code. We are reusing our code for Q: How can I instantiate SqlBulkCopy? It accepts SqlConnection, and I only have DbConnection.
var bulkCopy = new SqlBulkCopy (connection) // here connection SqlConnection {BatchSize = Settings.Default.BulkInsertBatchSize, NotifyAfter = 200, DestinationTableName = "Contact"};
Very easy, we use it this way and it works perfectly Does:
using (DB Connection Connection = DB. Connection Connection ()) {connection.Open (); // blah blah // We use SqlBulkCopy which is not in the Microsoft Data Access Layer Block. (SqlBulkCopy Copy = New SqlBulkCopy (SqlConnection) connection, SqlBulkCopyOptions.Default, null)) // // init & Amp; Blah blah}}
to enter the connection: (SqlConnection) connection
Comments
Post a Comment