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. General Programming
  3. C#
  4. Coping data from dataset to table

Coping data from dataset to table

Scheduled Pinned Locked Moved C#
helpdatabasexml
5 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.
  • K Offline
    K Offline
    KIDYA
    wrote on last edited by
    #1

    Hello Experts...... i have problem in my dataset has a table which i retrieve from a file,now i want to copy values from dataset to table.i used SQLBULKCOPY but cant work. Help me!! My Code:- <pre> DataTable dt= ds.Tables["MyNewTable"]; // This is a table i have in my dataset using (SqlBulkCopy bc = new SqlBulkCopy(conn)) { conn.Open(); bc.DestinationTableName = "dbo.XYZ"; // This is a table wid same schema as MyNewTable. // Starts the bulk copy. DataTable dt1=new DataTable("MyNewTable"); bc.WriteToServer(dt); ; // Closes the SqlBulkCopy instance bc.Close(); }

    S 1 Reply Last reply
    0
    • K KIDYA

      Hello Experts...... i have problem in my dataset has a table which i retrieve from a file,now i want to copy values from dataset to table.i used SQLBULKCOPY but cant work. Help me!! My Code:- <pre> DataTable dt= ds.Tables["MyNewTable"]; // This is a table i have in my dataset using (SqlBulkCopy bc = new SqlBulkCopy(conn)) { conn.Open(); bc.DestinationTableName = "dbo.XYZ"; // This is a table wid same schema as MyNewTable. // Starts the bulk copy. DataTable dt1=new DataTable("MyNewTable"); bc.WriteToServer(dt); ; // Closes the SqlBulkCopy instance bc.Close(); }

      S Offline
      S Offline
      Samer Aburabie
      wrote on last edited by
      #2

      Hi there, What kind of error you are getting ?! if no exception then did you make sure that the source datatable has data? and is the connection string correct to be for the destination database ?!

      Sincerely Samer Abu Rabie Imagination is more important than knowledge !

      K 1 Reply Last reply
      0
      • S Samer Aburabie

        Hi there, What kind of error you are getting ?! if no exception then did you make sure that the source datatable has data? and is the connection string correct to be for the destination database ?!

        Sincerely Samer Abu Rabie Imagination is more important than knowledge !

        K Offline
        K Offline
        KIDYA
        wrote on last edited by
        #3

        i am retriving d values in dataset from text file and i want to copy dataset values in d table,.n there was no any error in above code.

        S 1 Reply Last reply
        0
        • K KIDYA

          i am retriving d values in dataset from text file and i want to copy dataset values in d table,.n there was no any error in above code.

          S Offline
          S Offline
          Samer Aburabie
          wrote on last edited by
          #4

          Are you certain about the connection string and there is data in the source datatable ?!

          Sincerely Samer Abu Rabie Imagination is more important than knowledge !

          K 1 Reply Last reply
          0
          • S Samer Aburabie

            Are you certain about the connection string and there is data in the source datatable ?!

            Sincerely Samer Abu Rabie Imagination is more important than knowledge !

            K Offline
            K Offline
            KIDYA
            wrote on last edited by
            #5

            ya.my connection is ok.passing accurate connection string.and dataset gives data also.i checked using datareader. tell me how to bind datasource to table.i have same schema table in my database.

            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