Web.config 中的 Sql Server Express 和连接字符串

发布于 2024-11-28 16:35:29 字数 407 浏览 4 评论 0原文

我有连接字符串存储在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我是有多爱你 2024-12-05 16:35:30

这个 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文