Wanting to use a Progress Bar with SQLBulkCopy

progress-bar sqlbulkcopy vb.net


A question about the VB.NET application I'm building. To track the development of my project, I want to utilize a progress bar.SqlBulkCopy procedure. I did some research and pondered if employing anAddHandler in mySqlBulkCopy technique, utilizingSqlRowsCopied is one potential method for calculating the progress. If so, how would I go about doing this? I'm not quite familiar with VB.NET's progress bars. Please let me know if there is a better method to solve this; all responses are very appreciated! THANKS! Just a little excerpt of mySqlBulkCopy being carried out.

(FYI: The progress bar isn't reflecting any of the things I've tried.)

The progress bar's nametoolStripProgressBar :

Dim copy As New SqlBulkCopy(con)

For Each dc As DataColumn In dtDataCopy.Columns
    copy.ColumnMappings.Add(dc.ColumnName, dc.ColumnName)

copy.DestinationTableName = TableName
copy.BulkCopyTimeout = 360 
copy.BatchSize = 1000
10/22/2014 7:41:58 PM

Accepted Answer

According to the documents, theSqlRowsCopied the event depends on theNotifyAfter the property, NOTBatchSize property. You'd choose theMaximum from yourProgressBar according to the overall number of rows and theStep similar in property to theNotifyAfter value. whenever theSqlRowsCopied When an event occurs, you callPerformStep on theProgressBar and it will increase by whatever many duplicated rows there are.

As an alternative, you may only designate thee.RowsCopied worth to theValue possession of theProgressBar . The MSDN documentation for the event includes a code sample. It's to be hoped that before submitting this query, you read the documentation.

10/23/2014 2:22:49 AM

Related Questions

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow