SSIS双反斜杠导致连接问题 [英] SSIS Double Backslash is causing connection issues
问题描述
我正在使用执行SQL任务来提取动态信息来构建我的每个数据库的连接字符串。从那里我将他们传给一个Foreach循环。在这一点上,我使用一个表达式构建我的连接字符串:
I'm currently using an Execute SQL Task to pull in dynamic information to build my connection string for each of my databases. From there I'm passing them to a Foreach Loop. At this point I'm building my connection string using an expression:
Data Source =+ @ [User :: DatabaseServer] +\\ @ [User :: Instance] +; User ID =+ @ [User :: UserName] +; Password =+ @ [User :: Password] +; Initial Catalog = Defaul; Provider = SQLNCLI10.1;
"Data Source="+ @[User::DatabaseServer]+ "\\"+@[User::Instance]+";User ID="+@[User::UserName]+ ";Password="+ @[User::Password] +";Initial Catalog=Defaul;Provider=SQLNCLI10.1;"
当我的连接字符串用双反斜杠构建时,我的问题如下。
My issue is the following, when my connection string is built with a double backslash.
数据源= DatabaseServer\\InstanceName; User ID = UserName; Password = Password; Initial Catalog = Default; Provider = SQLNCLI10.1;
Data Source=DatabaseServer\\InstanceName;User ID=UserName;Password=Password;Initial Catalog=Default;Provider=SQLNCLI10.1;
有谁知道如何防止发生双反斜杠?我试图使用转义字符,但我已经取得了0个成功。
Does anyone know how to prevent the double backslash from occurring? I've tried to use the escape characters but I have had 0 success.
推荐答案
i found a work around of the issue :
what I have done is :
I have taken the first parameter for connction string like : "anystaring
and the second parameter for the db is : newdb"
so now check the screenshot I have given the URL(not able to upload the image sorry):
http://tinypic.com/view.php?pic=2v3oj6x&s=8#.VHQ8aSjrbcs
这篇关于SSIS双反斜杠导致连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!