C# 重新启动仿真器时,无法在sqlite windows phone 8.1中检索数据库值

C# 重新启动仿真器时,无法在sqlite windows phone 8.1中检索数据库值,c#,sqlite,visual-studio-2013,windows-phone-8.1,C#,Sqlite,Visual Studio 2013,Windows Phone 8.1,我在WindowsPhone8.1中使用Sqlite数据库设计了一个登录和注册页面。使用以下代码,我可以成功地从sqlite数据库中插入和检索值。但这种情况只发生一次。当我重新启动Emulator时,我无法从数据库中检索值 protected async override void OnNavigatedTo(NavigationEventArgs e) { var dbpath = ApplicationData.Current.LocalFolder.Path +

我在WindowsPhone8.1中使用Sqlite数据库设计了一个登录和注册页面。使用以下代码,我可以成功地从sqlite数据库中插入和检索值。但这种情况只发生一次。当我重新启动Emulator时,我无法从数据库中检索值

 protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
        var dbpath = ApplicationData.Current.LocalFolder.Path + "/ebook.db";
        var con = new SQLiteAsyncConnection(dbpath);
        await con.CreateTableAsync<Register>();
    }
    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        var dbpath = ApplicationData.Current.LocalFolder.Path + "/ebook.db";
        var con = new SQLiteAsyncConnection(dbpath);
        await con.CreateTableAsync<Register>();
        Register m = new Register();

        m.Name = text_reg.Text;
        m.Password = text_password.Password;
        string rd = "";
        if (radio_male.IsChecked == true)
        {
            rd = "Male";

        }
        else
        {
            rd = "Female";

        }
        m.Gender = rd;
        m.State = ((ComboBoxItem)combo_box.SelectedItem).Content.ToString();


        await con.InsertAsync(m);

        MessageDialog md = new MessageDialog("success");
        await md.ShowAsync();
    }

    private async void Button_Click_1(object sender, RoutedEventArgs e)
    {

        var dbpath = ApplicationData.Current.LocalFolder.Path + "/ebook.db";
        var con = new SQLiteAsyncConnection(dbpath);

        Register t = new Register();
        string query = string.Format("select Name,Password from Register where Name='{0}' and Password='{1}'", text_user.Text, text_pass.Password);
        List<Register> mylist = await con.QueryAsync<Register>(query);
        if (mylist.Count == 1)
        {
            t = mylist[0];
        }

        if (t.Name == text_user.Text && t.Password == text_pass.Password)
        {

            this.Frame.Navigate(typeof(MainPage));
        }
        else
        {
            var messagedialog = new MessageDialog("Unsuccessful").ShowAsync();
        }
    }
}
受保护的异步覆盖无效OnNavigatedTo(NavigationEventArgs e)
{
var dbpath=ApplicationData.Current.LocalFolder.Path+“/ebook.db”;
var con=新的SQLiteAsyncConnection(dbpath);
等待con.CreateTableAsync();
}
专用异步无效按钮\u单击(对象发送方,路由目标)
{
var dbpath=ApplicationData.Current.LocalFolder.Path+“/ebook.db”;
var con=新的SQLiteAsyncConnection(dbpath);
等待con.CreateTableAsync();
寄存器m=新寄存器();
m、 名称=文本\注册文本;
m、 Password=text\u Password.Password;
字符串rd=“”;
if(radio_male.IsChecked==true)
{
rd=“男性”;
}
其他的
{
rd=“女性”;
}
m、 性别=rd;
m、 状态=((ComboBoxItem)combo_box.SelectedItem.Content.ToString();
等待con.InsertAsync(m);
MessageDialog md=新建MessageDialog(“成功”);
等待md.ShowAsync();
}
专用异步无效按钮\u单击\u 1(对象发送方,路由目标)
{
var dbpath=ApplicationData.Current.LocalFolder.Path+“/ebook.db”;
var con=新的SQLiteAsyncConnection(dbpath);
寄存器t=新寄存器();
字符串查询=string.Format(“从寄存器中选择名称、密码,其中名称={0}和密码={1}',text_user.text,text_pass.Password);
List mylist=wait con.QueryAsync(查询);
如果(mylist.Count==1)
{
t=mylist[0];
}
if(t.Name==text\u user.text&&t.Password==text\u Password)
{
此.Frame.Navigate(typeof(MainPage));
}
其他的
{
var messagedialog=new messagedialog(“未成功”).ShowAsync();
}
}
}

这是预期的行为。状态未在Windows Phone emulator中持久化。重新启动时,它会丢失以前存储的所有数据(设置、安装的应用程序以及您在存储上写入的任何内容)

这不会发生在实际的物理设备上