Hi!
I have a very silly problem here.
i am setting some variables here from c# code.
Everything works fine except for Conn string. I understand statements that works fine in SQL does not act same in C# because of string literals.
I need an extra qoute \"" ......."/" that would execute in C#
\""Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;"\"
where as in c#
setting variable value as :
string scriptTaskConnectST = @."Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;";
executing this through c# code
jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f \"" + path + "\" /Set \\package.Variables[User::ArchivePackageName].Properties[Value];\"" + name + "\" /Set \\package.Variables[User::ScriptTaskConnectST].Properties[Value];\"" + scriptTaskConnectST + "\"
When i check i resulting vaue i get this for scriptTaskConnectST as
/"......\"
\"Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Integrated Security=SSPI;\"
how should i format it to get \""......"\"
Thanks,
Jasm
if i'm not mistaken, you've already asked this question in a previous incarnation. if true, i believe that i've already suggested that you use sql server agent stored procedures to run your package. you can execute any stored procedure from c# provided that your code has the proper permissions.
does my suggestion not work for you? if so, please tell me why that is.
|||I need to execute the packages through C# UI. Executing Throught the Agent is a secnd case now. But i found a work around method to set the connection string in my main package and set the value into the varaible which is used by all the pther sub packages. and it is working now.
I am already executing Stored proceedure through c# now for other implementations.
Thanks for your Suggestion.
Once i finish working through the UI i will try to execute throught the agent.
Jas
No comments:
Post a Comment