Wednesday, March 21, 2012

Need some help with DTexec execution

Hi!

When i excute in the sql server this works fine

xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx "'

but when i excute throught the C# code

jobCommand = new SqlCommand(@."xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx"'", cconn);

It shows up red lines near the " and ' qoutes. I know that quotation marks are wrong but don't know how to solve it.

some help please

Thanks

jas

When C# compiler encounters the second quote symbol (right after /f) it thinks this is the end of the string. To indicate this is embedded quote inside the string, double it, otherwise C# has no way to determine your intentions:

jobCommand = new SqlCommand(@."xp_cmdshell 'dtexec /f ""D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx""' ", cconn);

|||

Thanks a Lot It worked

Jas

|||

one more guidance needed with regard to the Quotation marks

path = @."D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx";

jobCommand = new SqlCommand(@."xp_cmdshell 'dtexec /f "'path '" /Set \package.Variables[User::ArchiveFileType].Properties[Value];""Excel""'", cconn);

How Do i set the path's value in c# the quotation marks are wrong again. cos i want to set value of path according to selection in the UI.

Select("deviceUniqueId = '" + deviceUniqueId + "'"); is an e.g of Doing in C# but when i implement it through text it does not recognize

Thanks

Jas

No comments:

Post a Comment