2011-01-19 38 views
4

web.config に次の接続文字列を書いていますが、それは私にerror.whatを書く正しい方法ですか?文字列内二重引用符で囲んだ二重引用符

<add name="stargaze_stargazeConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="D:\Work At DS\19th Jan\myastrolove.com_new\App_Data\dbName.mdf";Integrated Security=True;User Instance=True"/> 

答えて

14

:よう

"<add name=\"stargaze_stargazeConnectionString1\" connectionString=\"Data Source=.\SQLEXPRESS;AttachDbFilename=\"D:\Work At DS\19th Jan\myastrolove.com_new\App_Data\dbName.mdf\";Integrated Security=True;User Instance=True\"/>" 
+0

me.andのための仕事をうまく@Oded、緊急の返信にも感謝します。 –

2

、それを適切にエスケープする\""を交換してください。 web.configファイルはXMLですので、あなたが内側の引用符をエスケープする必要が

<add name="stargaze_stargazeConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=\"D:\Work At DS\19th Jan\myastrolove.com_new\App_Data\dbName.mdf\";Integrated Security=True;User Instance=True"/> 
+0

-1 - これはC#文字列ではなく、web.configにあります。これにより、依然としてOPのエラーが発生します。 – Oded

+0

質問を間違えたようです。 web.configの部分が表示されませんでした。それはあなたの答えを正しいものにするので、私はそれをupvoteします。 –

-1

それはすべきではない:あなたの文字列は次のようになりますことを意味し

&quot;

<add name="stargaze_stargazeConnectionString1" 
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;D:\Work At DS\19th Jan\myastrolove.com_new\App_Data\dbName.mdf&quot;;Integrated Security=True;User Instance=True"/> 
関連する問題