将 .sdf 文件移至独立存储中
如何将 .sdf 文件移动到我的独立存储中,移动后有办法删除它,因为它没有用。我已将 .sdf 文件添加为项目中的内容。
How do I move a .sdf file into my isolated storage and after I have moved it is there a way to delete it as it is of no use. I have added my .sdf file as a content in my project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题不是很清楚,但让我看看我是否明白。您创建了一个数据库,将其作为项目内容添加到您的文件中,以便在用户安装您的应用程序时可以显示所有数据。然后,您将只读 .sdf 文件中的数据复制到您在首次运行时创建的数据库中,以便可以对其进行读/写。正确的?
如果是这样,我不认为有办法删除安装中包含的只读文件。
如果您的数据库足够大,以至于您担心在手机上拥有两个副本会占用空间,我建议将您的数据放在服务器上,创建一个 Web 服务,并在首次运行时访问该 Web 服务。在屏幕上放置一个通知,让您的用户知道它正在下载的信息只会下载一次,并且后续启动不会花费那么长时间。确保包含代码以防止下载因电话、短信、后退键、开始按钮或其他事件而中断时出现问题。如果在之前的运行中中断,使其能够继续下载。
Your question is not very clear, but let me see if I get this. You created a database, added it to your file as content to your project so that you can have all the data present when the user installs your app. Then you are copying the data from the read-only .sdf file into a database that you are creating on first run, so that you can read/write to it. Correct?
If so, I do not believe there is a way to delete the read-only file that you included with the install.
If your database is large enough that you are concerned about the space it will take by having two copies of it on the phone, I would suggest placing your data on a server, creating a web service, and access that web service on first run. Place a notice on the screen that lets your user know that it is downloading information that will only be downloaded once, and that subsequent launches will not take as long. Be sure you include code to prevent a problem should the download be interrupted by a phone call, text message, back key press, start button, or other event. Make it be able to continue the download if it was interrupted in a prior run.
为了回答您的问题,.SDF 是 Microsoft SQL Server Compact (SQL CE) 数据库的一种格式。您粘贴的链接讨论了 SQLite 数据库。
这是将整个独立存储下载到您的设备上的方法。
打开 cmd 并转到以下目录
C:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool,
然后使用 isetool.exe 将隔离存储以及 .sdf 文件下载到您的计算机上。
isetool.exe ts xd [Product_id_here_see_WMAppManifest.xml] "D:\Sandbox"
您应该收到类似下载成功到 D:\Sandbox 的消息。
您还可以通过将参数 ts 更改为 rs 来上传 sdf
To answer your question, .SDF is a format of Microsoft SQL Server Compact (SQL CE) databases. The link you have pasted talks about SQLite databases.
This the way to download the entire Isolated Storage onto your device.
Open cmd and go to the following directory
C:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool
then use the isetool.exe to download the Isolated Storage along with the .sdf file onto your machine.
isetool.exe ts xd [Product_id_here_see_WMAppManifest.xml] "D:\Sandbox"
You should get message like download successful into D:\Sandbox.
You can also upload the sdf by changing the argument ts with rs