.sdf文件的路径不正确 [英] Incorrect Path to .sdf file
问题描述
嘿所有这些我是移动应用程序开发人员的新手,所以请耐心等待。
我正在尝试通过一个MSDN HOL来创建一个名为Vendors的移动数据库文件。 SDF。在我尝试更新"更新命令文本"之前,一切正常。在TableAdapter中。每当我点击elipses时,我都会收到以下错误:"路径不是合法形式。"在TableAdapter属性中,我看到连接字符串设置为:Data Source = .\Vendors.sdf这对我来说是正确的。
但是,我可以在我的数据源中预览数据,所以它似乎是DB已正确设置和映射。
有任何想法吗?
干杯!
Hey all so Im new to Mobile App Dev, so please bear with me.
I am trying to walk through a MSDN HOL in which I ahve to create a mobile Data Base file called Vendors.sdf. Everything was working fine until I tried to update the "Update Command Text" in a TableAdapter. Every time I click on the elipses I get the following error "The path is not of a legal form.". In the TableAdapter properties I see the connection string is set to : Data Source=.\Vendors.sdf which seems correct to me.
However, I can preview the data in my datasources so it seems the DB is set up and mapped correctly.
Any thoughts?
Cheers!
推荐答案
嗨BCP,<如果您在解决方案中包含vendors.sdf,则您的路径必须是这样的。
数据源="" \Program Files\Vendors\Sales.sdf
或动态获取该路径:
public
Hi BCP,
Your path must be something like this if you have included vendors.sdf in your solution
Data Source=""\Program Files\Vendors\Sales.sdf
or get that path dynamically:
public
static string DataFileName { static string DataFileName
{ 获取 { return 路径 ChangeExtension(<字体。 size = 2> return Path.ChangeExtension(
Assembly 。 GetExecutingAssembly()。GetName()。CodeBase, " .sdf" ); } Assembly.GetExecutingAssembly().GetName().CodeBase, ".sdf");
} } private 静态 string DataSourceConnectionString { private static string DataSourceConnectionString
{ get { 返回 string 。格式( < span style ="color:#a31515; font-size:x-small"> " Data Source = {0};" } get { return string.Format("Data Source = {0};", DataFileName); }
} 这篇关于.sdf文件的路径不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
另请检查此主题:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/22fabb72-1bfc-487c -8107-78cee4f89433 /
如果您对此有任何疑问,请与我们联系。
问候,> Malleswar
Also Check this thread:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/22fabb72-1bfc-487c-8107-78cee4f89433/
Please let me know if you have any queries regarding this.
Regards,
Malleswar