VB.net Speed Updating SQL table using data table
Posted on 2015-01-05
I connect to a SQL database in my VB.net project using the following code:
dTable2 = New DataTable
Dim connection As New SqlConnection(CS)
dbadp2 = New SqlDataAdapter(sSQL, connection)
Me.DataGridView1.DataSource = dTable2
I then add a few thousand rows with the following VB.net code (this is very fast)
My issue is then trying to save the new data back to SQL using the following code. It takes a few minutes.
Is there any faster way to do this?
Dim builder As New SqlCommandBuilder(dbadp2)
builder.QuotePrefix = "["
builder.QuoteSuffix = "]"
dbadp2.UpdateCommand = builder.GetUpdateCommand()