久久久久久久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 中的更新記錄的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時(shí)送ChatGPT賬號(hào)..

                在我的數(shù)據(jù)庫中,我有一個(gè)名為 question1 的表,初始默認(rèn)狀態(tài)分配為 = 0,然后每次我想更新時(shí)我都希望狀態(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è)置簡單數(shù)據(jù)庫的方式.

                This is how I would set up your simple database.

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

                It will create 3 entries with all Status = 0.

                在代碼中我說的那一行處設(shè)置一個(gè)斷點(diǎn);

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

                您會(huì)在該查詢之后看到所有 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 中的更新記錄的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 服務(wù)和 Cordova-SQLitePlugin?)
                can we use SQLite database in PWA app(我們可以在 PWA 應(yīng)用程序中使用 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>
                        • 主站蜘蛛池模板: 日韩国产高清在线观看 | 欧美亚洲国语精品一区二区 | 97超碰免费| 91极品视频 | 国产91丝袜在线18 | 91精品国产综合久久久久久漫画 | 久草福利| 日韩中文字幕在线观看视频 | 亚洲综合天堂网 | 久久伊人青青草 | 国产传媒在线播放 | a级毛片免费高清视频 | 亚洲国产精品久久久 | 国产精品九九九 | 日本不卡一区 | 超碰成人免费 | 亚洲高清久久 | 久久综合99| 国产精品看片 | 欧美精品一区二区三区一线天视频 | 日韩欧美一区二区三区 | 在线播放国产视频 | 亚洲精品久久久一区二区三区 | 天天干天天干 | 男人天堂网址 | 中文字幕亚洲一区 | 九色网址| 国产精品亚洲精品日韩已方 | 免费电影av | 黄一级| 日韩一区二区三区精品 | 日韩免费一区二区 | 国产精品视频久久 | 国产999精品久久久久久 | 亚洲欧洲一区 | 波多野结衣二区 | 日本一区二区在线视频 | 最新中文字幕第一页视频 | 范冰冰一级做a爰片久久毛片 | 欧美精品a∨在线观看不卡 欧美日韩中文字幕在线播放 | 天天干天天草 |