Hi Again,
Following is the implementation that I have used using OracleBulkCopy wherein I have mapped the DB & data table columns [Highlighted in yellow]. But in the 'Text Copy' how can I specify these mappings.
public static void MYFunc (DataTable dt)
{
string error = string.Empty;
OracleConnection connection = CreateConnection();
connection.Open();
OracleBulkCopy bulkCopyRecords = new OracleBulkCopy(connection);
bulkCopyRecords.DestinationTableName = "EMPLOYEE ";
bulkCopyRecords.ColumnMappings.Add("EMPLID", "EMPLOYEE_ID");
bulkCopyRecords.ColumnMappings.Add("CATEGORY_ID", "CATEGORY_ID");
try
{
bulkCopyRecords.WriteToServer(dt);
}
catch (Exception ex)
{
error = ex.Source + " -> " + ex.Message + "<br /><br />" + ex.StackTrace + "<br />";
}
finally
{
DisconnectConnection(connection);
}
}
Thanks
Abhishek Jain
Mercer | 5th - 9th Floors, Building No. 14A, Sector-24 & 25, DLF Cyber City, Gurgaon - 122002, Haryana, India
+91 124 477 2156 | Mobile +91 9891968728 | abhishek.jain2@mercer.com
www.mercer.com | Mercer India Private Limited
-----Original Message-----
From: Laurenz Albe <laurenz.albe@cybertec.at>
Sent: Wednesday, September 12, 2018 6:22 PM
To: Jain, Abhishek <Abhishek.Jain2@mercer.com>; pgsql-novice@postgresql.org
Subject: Re: OracleBulkCopy in PostGreSQL
Jain, Abhishek wrote:
> What is the equivalent of OracleBulkCopy in PostgreSQL?
Probably COPY: https://www.npgsql.org/doc/copy.html
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com