public void ACTION_PROCESS_BulkCopy_Calculate_5() { string procStock = @"ACT_DailyImport"; SQLCopy.DBConnectionDelegate d = new SQLCopy.MSSQL2005_DBConnection("FGA_PREPROD_RW"); DataSet ds = d.Execute("Execute " + procStock, connection_timeout: 60 * 60 * 60); }
/// <summary> /// /// </summary> /// <param name="sourceConnexion"></param> /// <param name="destConnexion"></param> /// <param name="mode">Exclude, Include or Aucun</param> /// <param name="liste">Liste des tables lié à l'option Mode</param> public static void DataBaseIntegrate (string CsvFileName, string destConnexion, string destSchema, string destTable, string csvFileEncoding = "iso-8859-1") { Encoding enc = null; switch (csvFileEncoding) { case "UTF8": enc = Encoding.UTF8; break; case "ASCII": enc = Encoding.ASCII; break; case "BigEndianUnicode": enc = Encoding.BigEndianUnicode; break; case "Unicode": enc = Encoding.Unicode; break; case "UTF32": enc = Encoding.UTF32; break; case "UTF7": enc = Encoding.UTF7; break; case "iso-8859-1": enc = Encoding.GetEncoding(28591); break; default: enc = Encoding.Default; break; } ; DatabaseTable destDataTable = new DatabaseTable(destSchema, destTable); /* * MSDBIntegration sql = new MSDBIntegration(destinationConnection: destConnexion); * sql.BulkUpsertCsv(CsvFileName,destDataTable); */ SQLCopy.MSSQL2005_DBConnection DestinationConnection = new SQLCopy.MSSQL2005_DBConnection(destConnexion); using (var reader = new CsvReader(new StreamReader(CsvFileName, enc), true, ';')) { try { DestinationConnection.Open(); CsvDataAdapter adapter = new CsvDataAdapter(reader); int nbTobeMergedRows = adapter.Fill(DestinationConnection, destDataTable, "yyyyMMdd"); } catch (Exception e) { throw e; } finally { DestinationConnection.Close(); } } }
public void ACTION_PROCESS_BulkCopy_DATA_FACTSET_DATA_1() { string filepath = @"G:\,FGA MarketData\FACTSET\201402\base_20140210.csv"; DataSet ds = new DataSet("DATA_FACTSET"); SQLCopy.MSSQL2005_DBConnection dest = new SQLCopy.MSSQL2005_DBConnection("FGA_RW"); using (var reader = new CsvReader(new StreamReader(new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)), true, '|')) { CsvDataAdapter adapter = new CsvDataAdapter(reader); // TODO : ajouter un objet de mapping sur le csvDataApdapter int nbReadLines = adapter.Fill(dest, new DatabaseTable("dbo", "DATA_FACTSET")); } }
public void LumenCSVReadValuesAndBulkCopyIntoDest_PROXY() { string proxyPath = @"G:\,FGA Systèmes\PRODUCTION\BASES\PROXY\20131231\portfolio\PortfolioHolding_MONNET.csv"; DataSet ds = new DataSet("PTF_PROXY"); SQLCopy.MSSQL2005_DBConnection dest = new SQLCopy.MSSQL2005_DBConnection("FGA_RW"); using (var reader = new CsvReader(new StreamReader(proxyPath, Encoding.UTF8), true, ';')) { CsvDataAdapter adapter = new CsvDataAdapter(reader); adapter.Fill(dest, new DatabaseTable("dbo", "#PTF_PROXY")); dest.Insert(new DatabaseTable("dbo", "PTF_PROXY"), new DatabaseTable("dbo", "#PTF_PROXY")); //adapter.Fill(dest, new DatabaseTable("dbo", "PTF_PROXY")); } }