Friday, March 23, 2012

Running the package through C# UI

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

You would normally use \ to escape a ". Remove the as that means you I cannot use the escape char, which I think you need to deal with teh quotes. Just escape the slashes as well.

string var = "This has a quite in, \", see and \\ is really a single slash?";

|||

Hi!

I know that \ is an escape character but what actually happens here is

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

i need to change this value accordingly.when i try to execute this statement

jobCommand = new SqlCommand(@."xp_cmdshell 'dtexec /f '" + path + "''", cconn);

i am getting this result - @."xp_cmdshell 'dtexec /f 'D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx''"

which is correctly getting the value of path but when i say

jobCommand.ExecuteNonQuery(); It fails because there is a single qoute which is set before the path value 'D:\SSISProject\Integration Services Project1\ArchiveTicket.dtsx' i think is the problem

Message @."Incorrect syntax near '\'."

What should i do i really need to get the value some thing like this

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

Thanks,

Jasmine

|||

If you know about escape characters that is good, but you are specifying @. which means escape sequences are not processed. Your previous version had doubel quotes which had not beeen escaped, so double them or use traditional escape syntax without the @.. You are trying to mix the two methods, you cannot us \ when you have @. in front as I tried to explain above.

Try -

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

jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f \"" + path + "\"'", cconn);

The evaluated command below looks good for SQL and also the DTEXEC path itself.

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

|||

Hi!

Thanks For your reply!

but this is very urgent please help!!!!!!!

I need one more help in this issue. what if i do not need any \ "

for e.g: i am trying to set conn string and varaible value

jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f \"" + path + "\" /Conn \"" + Packconn + "\" \"" + connect + "\" '",cconn);

i am getting some value like this :

CommandText "xp_cmdshell 'dtexec /f \"D:\\SSISProject\\Integration Services Project1\\ArchiveMainMultiTables.dtsx\" /Conn \"SE413695\\AASQL2005.TestDB;\" \"Provider=SQLNCLI.1;Data Source=SE413695\\AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;\" '" string

I do not need the highlighted escape characters in it. what should i do?

i need some thing like this :

xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveMainMultiTables.dtsx" /Conn SE413695\AASQL2005.TestDB;"Provider=SQLNCLI.1;Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;"'

Thanks,

Jas

No comments:

Post a Comment