static void Main(String[] args) { packageGeneration = new SimplePackageGenerator(); bool parseOk = false; try { parseOk = Parse(args); } catch (Exception e) { Console.WriteLine("Parsing command line has failed because: " + e.Message); } if (!parseOk) { StringBuilder sb = new StringBuilder("\n\nUsage: PkgGen -[SQL|Excel|File] SourceValue -[SQL|Excel|File] DestinationValue -C[REATENEW] {ON|OFF} -M[APCOLUMN] {ON|OFF} [-SAVE SSISPackagePath]\n\n"); sb.AppendLine("The value for each source and destination type is:"); sb.AppendLine("-SQL Host Name; Database Name; Table Name"); sb.AppendLine("-Excel Excel File Path; Sheet Name; {true|false}"); sb.AppendLine("-File Flat File Path; {true|false};"); sb.AppendLine(" {tab|comma|semicolon|colon|verticalbar};"); sb.AppendLine(" {ColumnName,Datatype[,Length][,Precision][,Scale];}(0+)"); sb.AppendLine("See Readme for more details of options and examples"); Console.WriteLine(sb.ToString()); return; } try { packageGeneration.ConstructPackage(createNewDest); } catch (Exception e) { Console.WriteLine("\nFailed to consturct package, the error message returned is: " + e.Message); return; } if (mapColumn) { colPairTable = null; if (!AskForMatchMap()) return; } packageGeneration.AddPathsAndConnectColumns(colPairTable); if (!packageGeneration.ValidatePackage()) { Console.WriteLine("\nFailed to validate the package, you can check the generated package in Business Intelligence Studio if it has been saved."); if (!String.IsNullOrEmpty(packagePath)) { packageGeneration.SavePackage(packagePath); } return; } if (!String.IsNullOrEmpty(packagePath)) { packageGeneration.SavePackage(packagePath); Console.WriteLine("\nSql Server Integration Services Package has been saved to "+packagePath); } String errors; if (packageGeneration.ExecutePackage(out errors)) { Console.WriteLine("\nTransfer has succeeded"); } else { Console.WriteLine("\nTransfer has failed. You can open the generated package in Business Intelligence Studio if it has been saved and debug there"); Console.WriteLine(errors); } }
static void Main(String[] args) { packageGeneration = new SimplePackageGenerator(); bool parseOk = false; try { parseOk = Parse(args); } catch (Exception e) { Console.WriteLine("Parsing command line has failed because: " + e.Message); } if (!parseOk) { StringBuilder sb = new StringBuilder("\n\nUsage: PkgGen -[SQL|Excel|File] SourceValue -[SQL|Excel|File] DestinationValue -C[REATENEW] {ON|OFF} -M[APCOLUMN] {ON|OFF} [-SAVE SSISPackagePath]\n\n"); sb.AppendLine("The value for each source and destination type is:"); sb.AppendLine("-SQL Host Name; Database Name; Table Name"); sb.AppendLine("-Excel Excel File Path; Sheet Name; {true|false}"); sb.AppendLine("-File Flat File Path; {true|false};"); sb.AppendLine(" {tab|comma|semicolon|colon|verticalbar};"); sb.AppendLine(" {ColumnName,Datatype[,Length][,Precision][,Scale];}(0+)"); sb.AppendLine("See Readme for more details of options and examples"); Console.WriteLine(sb.ToString()); return; } try { packageGeneration.ConstructPackage(createNewDest); } catch (Exception e) { Console.WriteLine("\nFailed to consturct package, the error message returned is: " + e.Message); return; } if (mapColumn) { colPairTable = null; if (!AskForMatchMap()) { return; } } packageGeneration.AddPathsAndConnectColumns(colPairTable); if (!packageGeneration.ValidatePackage()) { Console.WriteLine("\nFailed to validate the package, you can check the generated package in Business Intelligence Studio if it has been saved."); if (!String.IsNullOrEmpty(packagePath)) { packageGeneration.SavePackage(packagePath); } return; } if (!String.IsNullOrEmpty(packagePath)) { packageGeneration.SavePackage(packagePath); Console.WriteLine("\nSql Server Integration Services Package has been saved to " + packagePath); } String errors; if (packageGeneration.ExecutePackage(out errors)) { Console.WriteLine("\nTransfer has succeeded"); } else { Console.WriteLine("\nTransfer has failed. You can open the generated package in Business Intelligence Studio if it has been saved and debug there"); Console.WriteLine(errors); } }