Coping data from dataset to table
-
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(); }
-
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(); }
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 !
-
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 !
-
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.
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 !
-
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 !