Free templates
Menu Search Free templates

INSERT a DataTable with SqlDataAdapter and SqlBulkCopy (C#, VB and ASP.NET) | Free code

Here you can download free code (C# and VB) to insert many rows of data simultaneously in an INSERT into a SQL database, using a DataTable and SqlDataAdapter or SqlBulkCopy.

When you want to insert many rows of data into a database table, it is more advantageous to process all data in one lump compared to adding each row by individual INSERT INTO commands. If you have a list of rows with data to be stored in a database table, you can create a DataTable and then copy this data table to a database table with SqlDataAdapter or SqlBulkCopy.

A DataTable is a two-dimensional table with columns and rows that are stored in memory. To create a DataTable you have to create an object of the DataTable class, add columns and finally add rows to the data table. In this template have we created a DataTable from an ASP.NET table.

In this template with free code (C# and VB) to INSERT a DataTable to a database table have we created two examples to add many rows simultaneously using a DataTable. One method uses the SqlDataAdapter class and the second method uses the SqlBulkCopy class.

Remember that you in your web hosting account must have made a setting for the correct version of "ASP.NET" on your website (the version listed in the file "Web.config"). We are using Visual Web Developer 2005 (2010) Express Edition for web programming.
Updated: 01/01/2015 | Created by All-templates.biz

Download INSERT a DataTable with SqlDataAdapter and SqlBulkCopy (C#, VB and ASP.NET) | Free code ยป

Tags: sql database code