简体   繁体   English

wp8应用程序中的sdf文件

[英]sdf file in a wp8 application

I am working on a WP8 application and it using sqlite db for storing application data. 我正在处理WP8应用程序,它使用sqlite db存储应用程序数据。

I followed steps from the link http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone for doing the things . 我按照链接http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone的步骤进行操作。

But when I analyze my project files I can see one Appname.sdf file. 但是当我分析项目文件时,我可以看到一个Appname.sdf文件。 How this one is getting created automatically (if I remove it, still it generates automatically when I open solution). 如何自动创建此文件(如果我将其删除,则在打开解决方案时仍会自动生成)。 Is there any good explanation on this available? 有什么好的解释吗?

Just give a look at this code snippets in your reference link http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone 只需在您的参考链接http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone中查看此代码段即可

using (IsolatedStorageFileStream output = iso.CreateFile(MainPage.DB_PATH))
   {
    // Initialize the buffer.
    byte[] readBuffer = new byte[4096];
    int bytesRead = -1;

   // Copy the file from the installation folder to the local folder. 
   while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
      {
    output.Write(readBuffer, 0, bytesRead);
      }
    }

When execute "using (IsolatedStorageFileStream output = iso.CreateFile(MainPage.DB_PATH))" it creates a new file in isolated storage with no data. 当执行“使用(IsolatedStorageFileStream输出= iso.CreateFile(MainPage.DB_PATH))”时,它将在隔离存储中创建一个没有数据的新文件。 Thats why you always get a db file in your application. 这就是为什么您总是在应用程序中获得一个db文件的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM