到本地数据库文件的连接字符串不起作用

发布于 2024-07-13 06:06:35 字数 487 浏览 8 评论 0原文

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
     providerName="System.Data.SqlClient" />

这是服务器资源管理器为我的本地 MDF 文件提供的连接字符串。 尝试运行该应用程序时,我不断收到以下错误。

"Format of the initialization string does not conform to specification starting at index 25."

有谁知道这是什么吗?

谢谢!

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
     providerName="System.Data.SqlClient" />

This is the connection string that is provided to me from the Server Explorer for my local MDF file. I keep receiving the following error when attempting to run the application.

"Format of the initialization string does not conform to specification starting at index 25."

Anyone know what this is?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

屋顶上的小猫咪 2024-07-20 06:06:36

非常感谢大家。 我的问题实际上是我提供 NHibernate 配置的连接字符串。 看来本地数据文件路径不应该用 's 或 "s 括起来。感谢您的回复。

Thanks a lot everyone. My problem was actually with the connection string I was providing NHibernate configuration. It would appear that the local data file path should not be wrapped in 's or "s. Thanks for the replies.

枕头说它不想醒 2024-07-20 06:06:36

我想说的是文件名中的空格。 尝试将其括在 '' 中,例如

connectionString="AttachDbFilename='C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF';Integrated Security=True; User Instance=True"

或将其复制到 c:\ 进行测试

I'd say it is the spaces in file name. Try enclosing it in '' e.g.

connectionString="AttachDbFilename='C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF';Integrated Security=True; User Instance=True"

or copy it to c:\ for a test

等待我真够勒 2024-07-20 06:06:36

尝试替换:Integrated Security=True

为:Trusted_Connection=Yes

Try replacing: Integrated Security=True

With: Trusted_Connection=Yes

喜爱纠缠 2024-07-20 06:06:36

您是否尝试过在反斜杠上使用转义字符?

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
 providerName="System.Data.SqlClient" />

变成

connectionString="AttachDbFilename=C:\\Documents and Settings\\nmartin\\My Documents\\PS_Upload\\TimeTrack\\src\\TimeTracker\\TimeTrack\\App_Data\\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
 providerName="System.Data.SqlClient" />

Have you tried using escape characters on the backslashes?

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
 providerName="System.Data.SqlClient" />

becomes

connectionString="AttachDbFilename=C:\\Documents and Settings\\nmartin\\My Documents\\PS_Upload\\TimeTrack\\src\\TimeTracker\\TimeTrack\\App_Data\\ASPNETDB.MDF;Integrated Security=True; User Instance=True"
 providerName="System.Data.SqlClient" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文