当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteConnection.Update方法代码示例

本文整理汇总了C#中SQLite.SQLiteConnection.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.Update方法的具体用法?C# SQLiteConnection.Update怎么用?C# SQLiteConnection.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite.SQLiteConnection的用法示例。


在下文中一共展示了SQLiteConnection.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

 public void Update(Account currentAccount)
 {
     using (var connection = new SQLiteConnection(_dbPath))
     {
         connection.Update(currentAccount);
     }
 }
开发者ID:FLKone,项目名称:HFR4WinRT,代码行数:7,代码来源:AccountDataRepository.cs

示例2: OnSuccess

        public void OnSuccess(object response)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             Game game = (Game)response;
             string scoreid = game.GetScoreList()[0].GetScoreId();

             dbConn = new SQLiteConnection(DB_PATH);
             var testdata = dbConn.Query<Task>("select * from task where id='" + 1 + "'").FirstOrDefault();
             // Check result is empty or not
             if (testdata == null)
                 MessageBox.Show("id Not Present in DataBase");
             else
             {

                 var tp = dbConn.Query<Task>("update task set Scoreid='" + scoreid  + "' where Username = '" +testdata.Username  + "'").FirstOrDefault();
                 // Update Database
                 dbConn.Update(tp);
                
             }
             NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));


         });
        }
开发者ID:susheels,项目名称:Know-your-movie,代码行数:25,代码来源:transition.xaml.cs

示例3: UpdateLogEntry

 public void UpdateLogEntry(LogEntry selectedLogEntry)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Update(selectedLogEntry);
     }
 }
开发者ID:jimdejaeghere,项目名称:Gym-Logbook,代码行数:7,代码来源:LogEntryDAO.cs

示例4: UpdateExercise

 public void UpdateExercise(Exercise myExercise)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Update(myExercise);
     }
 }
开发者ID:jimdejaeghere,项目名称:Gym-Logbook,代码行数:7,代码来源:ExerciseDAO.cs

示例5: Results

        public Results()
        {
            InitializeComponent();
            App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY);
            string gameName;
            if ((int)settings["trigger"] == 0)
            {
                gameName = "Bollywood_game";
            }
            else
            {
                gameName = "Hollywood_game";
            }


            new_xp = Global.findxp(Global.p1Score, Global.p2Score);
            dbConn = new SQLiteConnection(DB_PATH);

            var tpdata = dbConn.Query<Task>("select * from task where id='" + 1 + "'").FirstOrDefault();
            // Check result is empty or not
            if (tpdata == null)
                MessageBox.Show("Title Not Present in DataBase");
            else
            {

                scoreId = tpdata.ScoreId;
                prev_xp = Convert.ToDouble(tpdata.XP);
                pres_xp = new_xp + prev_xp;

                var tp = dbConn.Query<Task>("update task set XP='" + pres_xp + "' where Username = '" + tpdata.Username + "'").FirstOrDefault();
                // Update Database
                dbConn.Update(tp);
               level =  Global.levelFromXP(pres_xp);
                switch(level)
                {
                    case 1:
                        achievementName = "level_1";
                        break;
                    case 2:
                        achievementName = "level_2";
                        break;
                    case 3:
                        achievementName = "level_3";
                        break;
                    case 4:
                        achievementName = "level_4";
                        break;
                    
                }
               
            }

            scoreBoardService.SaveUserScore(gameName, Global.localUsername, Global.p1Score, this);
          
            scoreBoardService.EditScoreValueById(scoreId, pres_xp, this);
            
            achievementService.EarnAchievement(Global.localUsername, achievementName, "xp_game", "",this);  
        }
开发者ID:susheels,项目名称:Know-your-movie,代码行数:58,代码来源:Results.xaml.cs

示例6: UpdateObject

 public void UpdateObject(Notes note)
 {
     using (var db = new SQLiteConnection(dbPath))
     {
        // var existing = db.Query<Notes>("select * from Notes where id = " + note.ID).FirstOrDefault();
         db.RunInTransaction(() => {
             db.Update(note);
         });
     }
 }
开发者ID:nguyendo94vn,项目名称:MeBe,代码行数:10,代码来源:ProcessDataBase.cs

示例7: Button_Click

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            using (SQLiteConnection conn = new SQLiteConnection("tempDb.db"))
            {
                conn.CreateTable(typeof(Person), CreateFlags.None);
                //conn.Insert(new Person { Name = "haha1" });

                conn.Update(new Person { Name = "haha1" ,Id=12334534 });
                System.Diagnostics.Debug.WriteLine(conn.Query<Person>("select * from Person where Name = ? ", "haha1").FirstOrDefault().Id);
            }
        }
开发者ID:fqncom,项目名称:tomcraporigami,代码行数:11,代码来源:MainPage.xaml.cs

示例8: UpdateGameData

 public void UpdateGameData(List<PuzzleGroup> puzzleGroupData, string userName)
 {
     var serializedPuzzleGroupData = Newtonsoft.Json.JsonConvert.SerializeObject(puzzleGroupData);
     var path = GetDatabasePath();
     using (var db = new SQLiteConnection(Path.Combine(path, "Puzzle.db")))
     {
         var puzzGroupData = db.Table<PuzzleGroupGameData>().FirstOrDefault(x => x.GameUserName == userName);
         if (puzzGroupData == null) return;
         puzzGroupData.Data = serializedPuzzleGroupData;
         db.Update(puzzGroupData);
         db.Commit();
     }
 }
开发者ID:abdulbaruwa,项目名称:CrossSharp,代码行数:13,代码来源:PuzzleRepository.cs

示例9: Save

 public void Save()
 {
     SQLiteConnection dbConnection = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite"));
     if (this.Id == 0)
     {
         // New 
         dbConnection.Insert(this);
     }
     else
     {
         // Update 
         dbConnection.Update(this);
     }
 }
开发者ID:yann510,项目名称:HolidayList,代码行数:14,代码来源:Person.cs

示例10: UpdateTactic

 public int UpdateTactic(Tactic tactic)
 {
     int rs = -1;
     using (var db = new SQLiteConnection(this.Path, this.State))
     {
         var existing = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault();
         if (existing != null)
         {
             existing = tactic.GetCopy();
             db.RunInTransaction(() =>
             {
                 rs = db.Update(existing);
             });
         }
     }
     return rs;
 }
开发者ID:hoangchunghien,项目名称:ChineseChessLearning,代码行数:17,代码来源:ViewModelTactic.cs

示例11: UpdateContact

 //Update existing conatct 
 public void UpdateContact(Contacts contact)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         var existingconact = dbConn.Query<Contacts>("select * from Contacts where Id =" + contact.Id).FirstOrDefault();
         if (existingconact != null)
         {
             existingconact.Name = contact.Name;
             existingconact.PhoneNumber = contact.PhoneNumber;
             existingconact.CreationDate = contact.CreationDate;
             dbConn.RunInTransaction(() =>
             {
                 dbConn.Update(existingconact);
             });
         }
     }
 }
开发者ID:trilok567,项目名称:Windows-Phone,代码行数:18,代码来源:DatabaseHelperClass.cs

示例12: UpdateUser

 public int UpdateUser(User user)
 {
     int rs = -1;
     using (var db = new SQLiteConnection(this.Path, this.State))
     {
         var existing = db.Query<User>("SELECT * FROM User WHERE ID=?", user.Id).FirstOrDefault();
         if (existing != null)
         {
             existing = user.GetCopy();
             db.RunInTransaction(() =>
             {
                 rs = db.Update(existing);
             });
         }
     }
     return rs;
 }
开发者ID:hoangchunghien,项目名称:ChineseChessLearning,代码行数:17,代码来源:ViewModelUser.cs

示例13: UpdateAccelData

        //Update existing conatct 
        public void UpdateAccelData(AccelData accelData)
        {
            using (var dbConn = new SQLiteConnection(App.DB_PATH))
            {
                var existing = dbConn.Query<AccelData>("select * from AccelData where Id =" + accelData.Id).FirstOrDefault();
                if (existing != null)
                {
                    existing.X = accelData.X;
                    existing.Y = accelData.Y;
                    existing.Z = accelData.Z;

                    dbConn.RunInTransaction(() =>
                    {
                        dbConn.Update(existing);
                    });
                }
            }
        }
开发者ID:RaedsLab,项目名称:TD1_Accel,代码行数:19,代码来源:DatabaseHelperClass.cs

示例14: insertUpdateUser

 /// <summary>
 /// Speichert oder updatet einen User in der lokalen DB
 /// </summary>
 /// <param name="data">User</param>
 /// <param name="path">SQLite Connection String</param>
 /// <returns>0 -> Update</returns>
 /// <returns>1 -> Insert</returns>
 /// <returns>-1 -> Exception</returns>
 public int insertUpdateUser(User data)
 {
     try
     {
         var db = new SQLiteConnection(path);
         if (db.Insert(data) != 0)
         {
             db.Update(data);
             return 0;
         }
         return 1;
     }
     catch (SQLiteException ex)
     {
         Console.WriteLine(ex.Message);
         return -1;
     }
 }
开发者ID:Fanuer,项目名称:fitnessApp,代码行数:26,代码来源:LocalDB.cs

示例15: SavePassword

        public void SavePassword(PasswordItem password)
        {
            using (SQLiteConnection context = new SQLiteConnection(_connectionString))
            {
                var existingPassword = (from p in context.Table<PasswordItem>()
                                       where p.Id == password.Id
                                       select p).FirstOrDefault();

                if (existingPassword != null)
                {
                    context.Update(password);
                }
                else
                {
                    context.Insert(password);
                }
            }
        }
开发者ID:hvining,项目名称:PasswordManager,代码行数:18,代码来源:PasswordRepository.cs


注:本文中的SQLite.SQLiteConnection.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。