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


C# SQLiteConnection.Delete方法代码示例

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


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

示例1: DeleteAccountFromAllTables

        /// <summary>
        /// Deletes the account from all tables.
        /// </summary>
        /// <param name="id">Identifier for the account..</param>
        public void DeleteAccountFromAllTables(int id)
        {
            SQLiteConnection con = new SQLiteConnection(ServerConstants.DB_PATH);

               con.Delete<TableAccount>(id);
               con.Delete<TableBuilding>(id);
               con.Delete<TableResource>(id);
               con.Delete<TableUnit>(id);
        }
开发者ID:Lopt,项目名称:ascendancy,代码行数:13,代码来源:DBHandle.cs

示例2: DeletePassword

 public void DeletePassword(PasswordItem _selectedPasswordItem)
 {
     using (SQLiteConnection context = new SQLiteConnection(_connectionString))
     {
         context.Delete(_selectedPasswordItem);
     }
 }
开发者ID:hvining,项目名称:PasswordManager,代码行数:7,代码来源:PasswordRepository.cs

示例3: DeleteWeighingEntry

 public void DeleteWeighingEntry(Weighing selectedWeighing)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Delete(selectedWeighing);
     }
 }
开发者ID:jimdejaeghere,项目名称:Gym-Logbook,代码行数:7,代码来源:WeightDAO.cs

示例4: DeleteLogEntry

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

示例5: DeleteExercise

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

示例6: EemaldaKontakt

 public int EemaldaKontakt(int id, SQLiteConnection c)
 {
     Kontakt[] k = this.otsiKontaktid(new Kontakt() { Id = id }, c);
     if (k.Length > 0)
     {
         return c.Delete(k[0]);
     }
     return 0;
 }
开发者ID:msokk,项目名称:Tact,代码行数:9,代码来源:Kasutaja.cs

示例7: DeleteObject

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

示例8: DeleteLogEntriesByExerciseId

        public void DeleteLogEntriesByExerciseId(int id)
        {
            using (var dbConn = new SQLiteConnection(App.DB_PATH))
            {
                ObservableCollection<LogEntry> lstLogEntries = GetLogEntries(id);

                foreach (var item in lstLogEntries)
                {
                    dbConn.Delete(item);
                }
            }
        }
开发者ID:jimdejaeghere,项目名称:Gym-Logbook,代码行数:12,代码来源:LogEntryDAO.cs

示例9: DeleteBeacon

 //Delete a Beacon
 public static int DeleteBeacon(int bID)
 {
     try
     {
         var db = new SQLiteConnection(dbPath);
         var result = db.Delete<Beacons>(bID);
         return result;
     }
     catch (Exception exc)
     {
         return -1;
     }
 }
开发者ID:Carbonchief,项目名称:SearchIt,代码行数:14,代码来源:Database.cs

示例10: DeleteTactic

 public int DeleteTactic(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)
         {
             db.RunInTransaction(() =>
             {
                 rs = db.Delete(existing);
             });
         }
     }
     return rs;
 }
开发者ID:hoangchunghien,项目名称:ChineseChessLearning,代码行数:16,代码来源:ViewModelTactic.cs

示例11: DeleteUser

 public int DeleteUser(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)
         {
             db.RunInTransaction(() =>
             {
                 rs = db.Delete(existing);
             });
         }
     }
     return rs;
 }
开发者ID:hoangchunghien,项目名称:ChineseChessLearning,代码行数:16,代码来源:ViewModelUser.cs

示例12: SetUp

        public void SetUp()
        {
            //var pathToDb = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "sessions.db");
            //var conn = new SQLiteConnection(pathToDb);

            //if (!File.Exists(pathToDb))
            //{
            //    File.Copy("sessions.db", pathToDb);
            //}

            db = new DatabaseFactory().InitDb();

            // Empty test Tasks
            var tasks = (from t in db.Table<Task>() select t);
            foreach (var task in tasks)
            {
                db.Delete(task);
            }
        }
开发者ID:cerikpete,项目名称:AutismImporter,代码行数:19,代码来源:DatabaseTests.cs

示例13: createSystemUser

        //-----------sets an fake user for recognizing if welcome screen should be ignored or not---------//
        protected void createSystemUser()
        {
            var db = new SQLiteConnection (dbPath);

            var rowCount = db.Table<User> ().Count ();

            if (rowCount > 2) {
                db.DeleteAll<User> ();
            }

            if (!hasInserted) {
                Log.Info (Tag, "libber");
                var result = insertUpdateData(new User{ ID = 2, FirstName = string.Format("SystemUser", System.DateTime.Now.Ticks),
                    LastName = "Mr.Anderson",
                }, db);
                hasInserted = true;
            } else {
                var rowcount = db.Delete(new User(){ID=2});
            }
        }
开发者ID:rhialy,项目名称:IMD3Amsterdam,代码行数:21,代码来源:WelcomeScreen.cs

示例14: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.myButton);

            string folder =  System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);

            var db = new SQLiteConnection (System. IO. Path. Combine (folder, "myDb. db"));

            button.Click  += delegate{

                Person Person = new Person{ Name = FindViewById<EditText> (Resource.Id.editText1).Text };

                int id = db.Insert(Person);

                FindViewById<TextView> (Resource.Id.textView2).Text = "Inserted with success: id "+id;

            };

            Button deleteButton = FindViewById<Button> (Resource.Id.button2);

            deleteButton.Click += delegate {

                var DeletedId = db.Delete<Person> (Convert.ToInt32(FindViewById<EditText> (Resource.Id.editText1).Text));

                FindViewById<TextView> (Resource.Id.textView2).Text = "Id " + Dele   	tedId +  "Deleted With Success";

            };

            db.Commit();
            db.Rollback();
        }
开发者ID:MathieuNls,项目名称:mastering-xamarin-studio,代码行数:38,代码来源:MainActivity.cs

示例15: FootballPlayerViewModel

        public FootballPlayerViewModel()
        {
            this.SaveCommand = new Command (() => {

            });

            this.FavouriteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => {
                using ( SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) {
                    List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName);
                    newplayerlist [0].Isfavourite = !(newplayerlist [0].Isfavourite);
                    connection.Update (newplayerlist [0]);
                }
                MessagingCenter.Send(this,"DBChanged");
            });

            this.DeleteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => {
                using (SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) {
                    List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName);
                    connection.Delete (newplayerlist [0]);
                }
                MessagingCenter.Send(this,"DBChanged");
            });
        }
开发者ID:ctsxamarintraining,项目名称:cts466856,代码行数:23,代码来源:FootballPlayerViewModel.cs


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