久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <small id='tphSW'></small><noframes id='tphSW'>

        <bdo id='tphSW'></bdo><ul id='tphSW'></ul>

    1. <tfoot id='tphSW'></tfoot>
      <i id='tphSW'><tr id='tphSW'><dt id='tphSW'><q id='tphSW'><span id='tphSW'><b id='tphSW'><form id='tphSW'><ins id='tphSW'></ins><ul id='tphSW'></ul><sub id='tphSW'></sub></form><legend id='tphSW'></legend><bdo id='tphSW'><pre id='tphSW'><center id='tphSW'></center></pre></bdo></b><th id='tphSW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tphSW'><tfoot id='tphSW'></tfoot><dl id='tphSW'><fieldset id='tphSW'></fieldset></dl></div>
      <legend id='tphSW'><style id='tphSW'><dir id='tphSW'><q id='tphSW'></q></dir></style></legend>
    2. Sqlite Window Phone 8 中的更新記錄

      Update Record in Sqlite Window Phone 8(Sqlite Window Phone 8 中的更新記錄)
      • <legend id='oq7V1'><style id='oq7V1'><dir id='oq7V1'><q id='oq7V1'></q></dir></style></legend>

            <bdo id='oq7V1'></bdo><ul id='oq7V1'></ul>
          • <i id='oq7V1'><tr id='oq7V1'><dt id='oq7V1'><q id='oq7V1'><span id='oq7V1'><b id='oq7V1'><form id='oq7V1'><ins id='oq7V1'></ins><ul id='oq7V1'></ul><sub id='oq7V1'></sub></form><legend id='oq7V1'></legend><bdo id='oq7V1'><pre id='oq7V1'><center id='oq7V1'></center></pre></bdo></b><th id='oq7V1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oq7V1'><tfoot id='oq7V1'></tfoot><dl id='oq7V1'><fieldset id='oq7V1'></fieldset></dl></div>

            <small id='oq7V1'></small><noframes id='oq7V1'>

                  <tbody id='oq7V1'></tbody>
              1. <tfoot id='oq7V1'></tfoot>
              2. 本文介紹了Sqlite Window Phone 8 中的更新記錄的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                在我的數(shù)據(jù)庫中,我有一個名為 question1 的表,初始默認狀態(tài)分配為 = 0,然后每次我想更新時我都希望狀態(tài) = 1,我使用命令

                In my database I have table named question1, with the initial default status assigned = 0, then every time I want to update I want the status = 1, I use the command

                await conn.ExecuteAsync("UPDATE question1 SET Status = '1' WHERE id =" + ques1.id);
                

                但它不起作用.誰知道這里出了什么問題?下面是讀取數(shù)據(jù)和更新表的代碼......

                but it is not working. Who knows what is wrong here? Here's the code to read the data and update the table......

                public async Task<question1> get_data_question1()
                {
                    SQLiteAsyncConnection conn = new SQLiteAsyncConnection("Database");
                    var query = conn.Table<question1>().Where(x => x.Status == 0);
                    var result = await query.ToListAsync();
                    question1 ques1 = new question1();
                    foreach (var item in result)
                    {
                        ques1.id = item.id;
                        ques1.Status = item.Status;
                    }
                    // Update
                    await conn.ExecuteAsync("UPDATE question1 SET Status = '1' WHERE id =" + ques1.id);
                    return ques1;
                }
                

                推薦答案

                這就是我設置簡單數(shù)據(jù)庫的方式.

                This is how I would set up your simple database.

                它將創(chuàng)建 3 個條目,所有狀態(tài) = 0.

                It will create 3 entries with all Status = 0.

                在代碼中我說的那一行處設置一個斷點;

                Put a break point at the line where I said so in the code;

                您會在該查詢之后看到所有 0 值都已更新為 1.

                You will see after that query all 0 values has been updated to 1.

                using SQLite;
                using System.IO;
                using System.IO.IsolatedStorage;
                using System.Threading.Tasks;
                
                public class Question
                {
                    [SQLite.PrimaryKey, SQLite.AutoIncrement]
                    public int Id { get; set; }
                    public int Status { get; set; }
                } 
                
                public partial class MainPage : PhoneApplicationPage
                {
                    string dbPath = "";
                    public MainPage()
                    {
                        InitializeComponent();
                        dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");                        
                
                        CreateDBTable();
                        InsertDB();         // only call this once (comment it out the next time you deploy)
                        UpdateDB();
                
                    }
                }
                
                // from the MSDN example
                private async Task<bool> FileExists(string fileName)
                {
                    var result = false;
                    try
                    {
                        var store = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync(fileName);
                        result = true;
                    }
                    catch
                    {
                    }
                    return result;
                }
                
                public void CreateDBTable()
                {
                    if (!FileExists("db.sqlite").Result)
                    {
                        using (var db = new SQLiteConnection(dbPath))
                        {
                            db.CreateTable<Question>();
                        }
                    } 
                }
                
                public void UpdateDB()
                {
                    using (var db = new SQLiteConnection(dbPath))
                    {
                        var existing = db.Query<Question>("SELECT * FROM Question WHERE Status = 0");
                        if (existing != null)
                        {
                            foreach(Question q in existing)
                            {
                                db.Execute("UPDATE Question SET Status = 1 WHERE Id = ?", q.Id);
                            }
                        }
                
                
                        // query again to see if has changed
                        existing.Clear();
                
                        existing = db.Query<Question>("SELECT * FROM Question WHERE Status = 1");
                        if (existing != null)
                        {
                            int breakpoint_here = 1;
                        }
                
                    } 
                }
                
                private void InsertDB()
                {
                    using (var db = new SQLiteConnection(dbPath))
                    {
                        db.RunInTransaction(() =>
                        {
                            db.Insert(new Question() { Status = 0 });
                            db.Insert(new Question() { Status = 0 });
                            db.Insert(new Question() { Status = 0 });
                        });
                    }
                }
                

                這篇關(guān)于Sqlite Window Phone 8 中的更新記錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Build SQLite for windows phone 8(為 Windows Phone 8 構(gòu)建 SQLite)
                SQLite 3.8.2 exception on Update statement(更新語句上的 SQLite 3.8.2 異常)
                How to create database and table in sqlite programatically using monotouch?(如何使用monotouch以編程方式在sqlite中創(chuàng)建數(shù)據(jù)庫和表?)
                Xamarin SQLite quot;This is the #39;bait#39;quot;(Xamarin SQLite“這是‘誘餌’)
                How do I use the ngCordova sqlite service and the Cordova-SQLitePlugin with Ionic Framework?(如何在 Ionic 框架中使用 ngCordova s??qlite 服務和 Cordova-SQLitePlugin?)
                can we use SQLite database in PWA app(我們可以在 PWA 應用程序中使用 SQLite 數(shù)據(jù)庫嗎)

                <tfoot id='ULlSM'></tfoot>
                    <legend id='ULlSM'><style id='ULlSM'><dir id='ULlSM'><q id='ULlSM'></q></dir></style></legend>

                        <i id='ULlSM'><tr id='ULlSM'><dt id='ULlSM'><q id='ULlSM'><span id='ULlSM'><b id='ULlSM'><form id='ULlSM'><ins id='ULlSM'></ins><ul id='ULlSM'></ul><sub id='ULlSM'></sub></form><legend id='ULlSM'></legend><bdo id='ULlSM'><pre id='ULlSM'><center id='ULlSM'></center></pre></bdo></b><th id='ULlSM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ULlSM'><tfoot id='ULlSM'></tfoot><dl id='ULlSM'><fieldset id='ULlSM'></fieldset></dl></div>
                          <tbody id='ULlSM'></tbody>

                        <small id='ULlSM'></small><noframes id='ULlSM'>

                        • <bdo id='ULlSM'></bdo><ul id='ULlSM'></ul>
                        • 主站蜘蛛池模板: 日本高清视频在线播放 | 久久久久久成人 | 亚洲精品乱码久久久久久按摩观 | 中文字幕1区2区 | 亚洲不卡 | 天天综合网91 | 国产精品免费一区二区 | 亚洲成人在线视频播放 | 国产视频一区二区 | 日韩成人免费av | 亚洲国产高清在线 | 久久福利 | 久久久av | 日韩免费在线 | 国产乱码精品一区二区三区中文 | av三级在线观看 | 91精品国产乱码久久久久久久久 | 欧美精品一区在线 | 亚洲夜射 | 国产午夜精品一区二区三区嫩草 | 成人一区在线观看 | 国产精品免费一区二区三区四区 | 日日摸夜夜添夜夜添精品视频 | 91精品国产91久久久久久吃药 | 亚洲激情网站 | 亚洲国产网址 | 久久99精品国产 | 色婷婷国产精品综合在线观看 | 国产视频1区2区 | 欧美三区视频 | 香蕉大人久久国产成人av | 成人国产精品免费观看视频 | 久久大| 久久久亚洲一区 | 国产91 在线播放 | 亚洲日日 | 亚洲一区免费在线 | 日本高清不卡视频 | 欧美电影大全 | 欧美 日本 国产 | 97人人草|