Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Bulk Insert into database from datatable or dataset or datagrid

Bulk Insert into database from datatable or dataset or datagrid

Scheduled Pinned Locked Moved ASP.NET
databasetutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yesu prakash
    wrote on last edited by
    #1

    Hi, How to insert a bulk data from a datatable or dataset or datagrid into database in a single click. Thankyou YPKI

    R 1 Reply Last reply
    0
    • Y yesu prakash

      Hi, How to insert a bulk data from a datatable or dataset or datagrid into database in a single click. Thankyou YPKI

      R Offline
      R Offline
      rkrishnach
      wrote on last edited by
      #2

      Add all rows to the datatable. Then use sqlbulkcopy.It inserts all the records into database table in one shot. SqlConnection destinationConnection = new SqlConnection(strConnection); destinationConnection.Open(); SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection ); bulkCopy.DestinationTableName = "destination"; bulkCopy.WriteToServer(yourDatatable); destinationConnection .Close();

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups