how to insert data from datatable to database with single insert statement

Posted by Mrutyunjay51 under ASP.NET on 5/22/2011 | Points: 10 | Views : 11020 | Status : [Member] | Replies : 3
how to insert data from datatable to database with single insert statement




Responses

Posted by: Raja on: 5/22/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Mrutyunjay51,

Read this article http://www.itfunda.com/how-to-insert-records-into-the-database/Free/126.

Thanks


Regards,
Raja, USA

Mrutyunjay51, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mcadeepuraj on: 5/23/2011 [Member] Starter | Points: 25

Up
0
Down
you can use bulkcopy insert

e.g
Dim sqlbulkSubt As New SqlBulkCopy(con)
sqlbulkSubt.DestinationTableName = "your Database table name"
sqlbulkSubt.ColumnMappings.Add("Column_Source", "Column_destination")
sqlbulkSubt.ColumnMappings.Add("Column_Source", "Column_destination")
sqlbulkCert.WriteToServer(Your Source table name)


Deepak Kumar

Mrutyunjay51, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhwinder.ghuman on: 5/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
You can use SqlBulkCopy ti insert data from datatable to database.


Best Regards
Lakhwinder Ghuman

Mrutyunjay51, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response