public bool BulkInsertTable(DataTable dt) { bool isSuccess = false; try { SqlBulkCopy objbulk = new SqlBulkCopy(DbClass.openConnectionForBulk()); //assign Destination table name objbulk.DestinationTableName = "ProductTable"; // NOTE: no need to perform column mapping while bulk insert if the mapping columns have the same name as destination column //objbulk.ColumnMappings.Add("product_type", "product_type"); //objbulk.ColumnMappings.Add("brand_code", "brand_code"); //objbulk.ColumnMappings.Add("delivery_agent", "delivery_agent"); //objbulk.ColumnMappings.Add("vendor", "vendor"); //insert bulk Records into DataBase. objbulk.WriteToServer(dt); isSuccess = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); isSuccess = false; } finally { DbClass.closeConnection(); } return(isSuccess); }