在Windows Phone 8中使用SQlite数据库时,应用程序无法正常工作

时间:2015-04-17 06:49:26

标签: sqlite window windows-phone-8.1

我在Windows Phone 8.1中开发了我的第一个应用程序。它在我的本地模拟器和设备上正常工作但是无论何时我在商店上传应用程序都无法正常工作。每当我打开应用程序时它都会突然回来。我使用了我的应用程序中的SQlite数据库。当我没有使用Sqlite数据库时它工作正常(我上传到测试版)。请任何人帮我解决这个问题。 提前谢谢

sqlite代码:

public async void createdatabase()
        {

            SQLiteConnectionString c = new SQLiteConnectionString(System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "newDB.db"), true);
            var conn = new SQLiteAsyncConnection(c.DatabasePath);

 await conn.CreateTableAsync<Operators>();
}


 public async void Drop()
        {

             SQLiteConnectionString c = new SQLiteConnectionString(System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "newDB.db"), true);
             using (var dbConn = new SQLiteConnection(c.DatabasePath))
             {

                 SQLiteCommand cmd = new SQLiteCommand(dbConn);
                 cmd.CommandText = "DROP TABLE IF EXISTS Operators";
                 int response = cmd.ExecuteNonQuery();
}
 public async void insert()
        {

            rechargeOperator1.Items.Clear();
            rechargeCircles1.Items.Clear();
            SQLiteConnectionString c = new SQLiteConnectionString(System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "newDB.db"), true);
            var conn = new SQLiteAsyncConnection(c.DatabasePath);

            var client = new pavandatabase.JsonWebClient();

            var resp1 = await client.DoRequestAsync(Url.weburl + "getRechargeCircleList");
            string result1 = resp1.ReadToEnd();
            JArray jsonArray = JArray.Parse(result1);

            for (int j = 0; j < jsonArray.Count; j++)
            {
                JObject jobj = (JObject)jsonArray[j];

                string id = (string)jobj["CircleID"];
                string statename = (string)jobj["CircleName"];


                //circles combobox......
                rechargeCircles1.Items.Add(statename);

               Operators op = new Operators();
                   op.Operatorid = int.Parse(OperatorID);
                  op.Operatorname = Operator;
                  op.servicetypeid = int.Parse(ServiceTypeID);
                  await conn.InsertAsync(op);
            }

1 个答案:

答案 0 :(得分:0)

尝试将断点放在应用程序的第一行,并继续按f10并查看它输出的哪一行并发布该行。

希望它能帮助您获得解决方案。

谢谢,