Protected Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click Dim dt As New DataTable() dt.Columns.Add("TDSMRANGE") For Each row As GridViewRow In gdTDSM.Rows Dim TDSMRANGE As Integer = row.Cells(0).Text dt.Rows.Add(TDSMRANGE) Next If dt.Rows.Count > 0 Then Try Using sqlBulkCopy As New SqlBulkCopy(connection) 'Set the database table name sqlBulkCopy.DestinationTableName = "dbo.TDSM" If connection.State = ConnectionState.Closed Then connection.Open() End If Try sqlBulkCopy.WriteToServer(dt) Catch ex As Exception fnMessage(Me, ex.Message) End Try connection.Close() End Using Catch EX As Exception fnMessage(Me, EX.Message) End Try End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)