PC的智能设备路径Visual c# [英] Smart Device path to PC Visual c#

查看:82
本文介绍了PC的智能设备路径Visual c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在将智能设备应用程序中的数据导入到其连接的PC时出现问题,数据库文件是sqlserverce.sdf文件,我可以导入这个,如果我直接将数据库文件从设备移动到计算机本身的位置,如C:\ Program Files \ Databasename.sdf



但是当它仍然在设备中时试图打开数据库会给我带来很多麻烦,我使用system.IO找到了设备本身的执行应用程序路径,它给了我一个结果\ Program\Databasefolder,我添加了\Programs \Databasefolder \Databasename.sdf



但是仍然无法正常工作,PC的完整路径是Computer \ Devicename \程序\Databasefolder \Databasename.sdf并且它不能正常工作



并且如上所述将文件移动到c:\programfiles \ databasename.sdf使连接字符串工作。

ex:



SqlCeConnection connect = new SqlCeConnection(@Data Source = C:\Program Files \ databasename.sdf );





如何从PC应用程序中找到并使用设备本身的完整路径?

I'm having problems importing data in a smart device application into the pc that it's connected to, the database file is an sqlserverce.sdf file, I can import this if I were to directly move the database file from the device into a location in the computer itself, like C:\Program files\Databasename.sdf

but trying to open the database while it's still in the device is causing me a lot of trouble, I located the executing applications path in the device itself using system.IO which gave me a result \Programs\Databasefolder, to which I added \Programs\Databasefolder\Databasename.sdf

but still does not work, the full path from the pc is Computer\Devicename\Programs\Databasefolder\Databasename.sdf and it does not work as well

and as stated moving the file to c:\programfiles\databasename.sdf makes the connection string work.
ex:

SqlCeConnection connect = new SqlCeConnection(@"Data Source = C:\Program Files\databasename.sdf");


How do I locate and use the full path from the device itself from the PC application?

推荐答案

您可能需要更改连接字符串:对于外部设备,我希望它类似于

You probably need to change the connection string: for an external device I would expect it to be something like
SqlCeConnection connect = new SqlCeConnection(@"Data Source = \\DEVICENAME\Programs\Databasefolder\Databasename.sdf ");



首先浏览文件:使用Windows资源管理器查看左侧的网络节点。如果你到达设备,浏览到该文件并单击Windows资源管理器的地址栏 - 这将为您提供可以复制和粘贴的实际文件夹路径。直到你可以在那里找到它,你有可能无法访问该文件!


Start by browsing to the file: use Windows Explorer and have a look via the "Network" node on the left. If you get to the device, browse to the file and click in the address bar of Windows Explorer - that will give you an actual folder path you can copy and paste. Until you can find it there, the chances are you can't access the file!


这篇关于PC的智能设备路径Visual c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆