Monday, 15 March 2010

asp.net - How do I pass DTEXEC utility command line arguments to process.start using C# syntax? -



asp.net - How do I pass DTEXEC utility command line arguments to process.start using C# syntax? -

i have pass parameters dtexec utility through asp.net code. using process.start() method trigger ssis bundle execution.

string 1 dtexec /file c:\ssis\pkg1.dtsx /conn "myconnectionmanager";"\"data source=localhost\testsql2008r2;initial catalog=conndb;integrated security=sspi;\"" string 2 /file c:\ssis\pkg1.dtsx /conn "myconnectionmanager;data source=localhost\testsql2008r2;initial catalog=conndb;integrated security=sspi;"

the above command line arguments generated while manually executing bundle through dtexec utility. however, need pass through command line process.start() method in asp.net using c#.

how can represent above command line within c# string statement? in other words, how escape special characters making utilize of @ character , pass valid statement process.start()?

a verbatim string literal easiest utilize hard coding such strings.

you need double every inner ":

@"dtexec /file c:\ssis\pkg1.dtsx /conn ""myconnectionmanager"";""\""data source=localhost\testsql2008r2;initial catalog=conndb;integrated security=sspi;\""""";

and:

@"/file c:\ssis\pkg1.dtsx /conn ""myconnectionmanager;data source=localhost\testsql2008r2;initial catalog=conndb;integrated security=sspi;""";

with "regular" strings, need escape each " , \ in original \ before them.

c# asp.net ssis

No comments:

Post a Comment