Web.config 中的 Sql Server Express 和连接字符串
我有连接字符串存储在 web.config 文件中,但它给了我错误。
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbProduct.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
连接字符串中的错误在哪里。我已将我的数据库 DbProduct.mdf 存储在 app_data 文件夹中。我从来没有使用过 SQLEXPRESS。所以我需要指导方针。谢谢
i have connection string stored in web.config file but it is giving me the error.
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbProduct.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
where is the bug in the connection string. i have stored my db DbProduct.mdf in app_data folder. i have never use SQLEXPRESS. so i need guide line. thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个
AttachDbFilename=|DataDirectory|\DbProduct.mdf
应该是
AttachDbFilename=|DataDirectory|DbProduct.mdf
你不需要添加
\
有看看这个在 ASP.NET v2.0 中使用 web.config 中的连接字符串
this
AttachDbFilename=|DataDirectory|\DbProduct.mdf
should be
AttachDbFilename=|DataDirectory|DbProduct.mdf
You don't need to add
\
Have a look at this Using connection strings from web.config in ASP.NET v2.0