Ejemplo n.º 1
0
        public static void HapusData(string id)
        {
            DataTugas databaseObject = new DataTugas();

            databaseObject.OpenConnection();
            using (SQLiteCommand cmd = new SQLiteCommand(databaseObject.myConnection))
            {
                cmd.CommandText = "DELETE FROM DataTugas WHERE ID = @I";
                cmd.Prepare();
                cmd.Parameters.AddWithValue("@I", int.Parse(id));
                cmd.ExecuteNonQuery();
            }
            databaseObject.CloseConnection();
        }
Ejemplo n.º 2
0
        public static void EditData(string nama, string deadline, string kategori, string deskripsi, string id)
        {
            DataTugas databaseObject = new DataTugas();

            databaseObject.OpenConnection();
            using (SQLiteCommand cmd = new SQLiteCommand(databaseObject.myConnection))
            {
                cmd.CommandText = "UPDATE DataTugas "
                                  + "SET NamaTugas = @N, Deadline = @D, Kategori = @K, Deskripsi = @Ds "
                                  + "WHERE Id = @I";
                cmd.Prepare();
                cmd.Parameters.AddWithValue("@I", int.Parse(id));
                cmd.Parameters.AddWithValue("@N", nama);
                cmd.Parameters.AddWithValue("@D", deadline);
                cmd.Parameters.AddWithValue("@K", kategori);
                cmd.Parameters.AddWithValue("@Ds", deskripsi);
                cmd.ExecuteNonQuery();
            }
            databaseObject.CloseConnection();
        }