User77

User77

  • NA
  • 52
  • 27.4k

same columns for different tables using sqlbulkcopy

Oct 27 2016 9:25 AM
Hi in my web application, I have 4 Data base tables and  3 tables are have same column names and how can i take in sqlbulkcopy method. Can anyone please tell me
objbulk.DestinationTableName = "Adjustments"; 
objbulk.DestinationTableName = "Payments";
objbulk.DestinationTableName = "Charges";
objbulk.ColumnMappings.Add("ID", "ID");
objbulk.ColumnMappings.Add("Description", "Description");
objbulk.ColumnMappings.Add("Credits", "Credits");
objbulk.ColumnMappings.Add("QTY%", "QTYInPercentage");
objbulk.ColumnMappings.Add("Amount", "Amount");
objbulk.ColumnMappings.Add("Amount %", "AmountInPercentage");
objbulk.ColumnMappings.Add("Client", "Client");
con.Open();
objbulk.WriteToServer(dt);
con.Close(); 
 
Thank you

Answers (1)