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


C# SQLiteConnection.Query方法代码示例

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


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

示例1: 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

示例2: addCompletedCircle

        public static void addCompletedCircle(Circle circle)
        {
            completeCircles.Add(circle);

            string dbPath = GetDBPath();
            SQLiteConnection db;
            db = new SQLiteConnection(dbPath);
            db.Insert(circle);

            var result = db.Query<Line>("SELECT * FROM Lines");
            foreach (Line l in result) {
                Console.WriteLine("Line DB: bx {0}, by {1}, ex {2}, ey {3}", l.begin.X, l.begin.Y, l.end.X, l.end.Y);
            }
            var result2 = db.Query<Circle>("SELECT * FROM Circles");
            foreach (Circle c in result2) {
                Console.WriteLine("Circle DB: cx {0}, cy {1}, p2x {2}, p2yy {3}", c.center.X, c.center.Y, c.point2.X, c.point2.Y);
            }

            db.Close();
            db = null;

            foreach (Line l in completeLines) {
                Console.WriteLine("Line CL: bx {0}, by {1}, ex {2}, ey {3}", l.begin.X, l.begin.Y, l.end.X, l.end.Y);
            }
            foreach (Circle c in completeCircles) {
                Console.WriteLine("Circle CC: cx {0}, cy {1}, p2x {2}, p2yy {3}", c.center.X, c.center.Y, c.point2.X, c.point2.Y);
            }
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:28,代码来源:LineStore.cs

示例3: 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

示例4: OnCreate

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

			SetContentView (Resource.Layout.ChatLayout);

			//LISTVIEW
			mListView = FindViewById<ListView> (Resource.Id.listViewBox);

			mItems = new List<TableMessages> ();

			string dbPath = System.IO.Path.Combine (System.Environment.GetFolderPath
				(System.Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection (dbPath);
			DBRepository dbr = new DBRepository ();

			var table = db.Query<TableMessages> ("SELECT * FROM TableMessages where codeChauffeur=?",Data.userAndsoft);
			var i = 0;

			foreach (var item in table) {
				mItems.Add (new TableMessages () {
					texteMessage = item.texteMessage,
					utilisateurEmetteur = item.utilisateurEmetteur,
					statutMessage = item.statutMessage,
					dateImportMessage = item.dateImportMessage,
					typeMessage = item.typeMessage,
					Id = item.Id
				});
				i++;
			}

			if(i > 6){
				View view = LayoutInflater.From (this).Inflate (Resource.Layout.ListeViewDelete, null, false);
				mListView.AddHeaderView (view);
				view.Click += Btndeletemsg_Click;
			}

			adapter = new ListeViewMessageAdapter (this, mItems);
			mListView.Adapter = adapter;

			//EDITTEXT
			var btnsend = FindViewById<LinearLayout>(Resource.Id.btn_send);
			btnsend.Click += Btnsend_Click;

			//STATUT DES MESSAGES RECU TO 1
			var tablemsgrecu = db.Query<TableMessages> ("SELECT * FROM TableMessages where statutMessage = 0");
			foreach (var item in tablemsgrecu) {
				var updatestatutmessage = db.Query<TableMessages> ("UPDATE TableMessages SET statutMessage = 1 WHERE statutMessage = 0");
				var resintegstatut = dbr.InsertDataStatutMessage (1,DateTime.Now,item.numMessage,"","");
			}

		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:52,代码来源:MessageActivity.cs

示例5: UpdateLV

        public void UpdateLV(SQLiteConnection connect)
        {

            var Decks = connect.Query<Deck>("SELECT * FROM Deck");
            lvDecks.ItemsSource = Decks;

        }
开发者ID:GlebGruzdov,项目名称:Test,代码行数:7,代码来源:MainPage.xaml.cs

示例6: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string msg = "";
            int index = 0;
            if (NavigationContext.QueryString.TryGetValue("msg", out msg))
            {
                index = Convert.ToInt32(msg);
            }

            using (var db = new SQLiteConnection(MainPage.dbPath))
            {
                existing = db.Query<Person>("select * from Person where Id = " + index).ToList();
                if (existing != null)
                {
                    BitmapImage b = new BitmapImage();
                    b = MainPage.BytesToImage(existing[0].Images);

                    tb_name.Text = existing[0].Names;
                    tb_number.Text = existing[0].Numbers;
                    tb_email.Text = existing[0].Emails;
                    pic.Source = b;

                    pic.Opacity = 10;

                    tb_address.Text = existing[0].Addresses;
                    tb_website.Text = existing[0].Websites;
                }
            }
        }
开发者ID:khateeb321,项目名称:ContactsApp,代码行数:30,代码来源:Profile.xaml.cs

示例7: getDrinks

		public static List<Drink> getDrinks()
		{
			var conn = new SQLiteConnection (System.IO.Path.Combine (documentsFolder(), "database.db"));
			var results = conn.Query<Drink> ("SELECT * FROM Drink");
			conn.Close ();
			return results;
		}
开发者ID:Spectrewiz,项目名称:BAC_App,代码行数:7,代码来源:Database.cs

示例8: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (NavigationContext.QueryString.ContainsKey("transaccion"))
                transaccion = NavigationContext.QueryString["transaccion"].ToString();

            if (transaccion.Equals("crear"))
                Mensaje.Text = "       Selecciona el cliente para \n               agregar pedido";
            else
                if (transaccion.Equals("consultar"))
                {
                    Mensaje.Text = "       Selecciona el cliente para \n               consultar pedido";
                }

            db = new SQLiteConnection("naturapp.db");

            var count = (from x in db.Table<tablaClientes>() select x.idCliente).Count();
            if (count > 0)
            {
                clientes = db.Query<tablaClientes>("SELECT idCliente, nombres, apellidos, direccion, telefono, correo, sexo, fechaNacimiento, estadoCivil from tablaClientes");

                arrClientes = new ObservableCollection<Cliente>();
                foreach (var cliente in clientes)
                {
                    arrClientes.Add(new Cliente(cliente.idCliente.ToString(), cliente.nombres, cliente.apellidos, cliente.direccion, cliente.telefono, cliente.correo, cliente.sexo, cliente.fechaNacimiento, cliente.estadoCivil));
                }

                listClientes.ItemsSource = arrClientes;
            }
            else
            {
                MessageBox.Show("No hay clientes agregados");
            }

            base.OnNavigatedTo(e);
        }
开发者ID:Ergon-FCA,项目名称:NaturApp,代码行数:35,代码来源:consultaClientePedidos.xaml.cs

示例9: UnshufflePlaylist

        private void UnshufflePlaylist(SQLiteConnection connection, int currentSong)
        {
            connection.Execute("update CurrentPlaylistSong set Rank = ActualRank");

            var song = connection.Query<CurrentPlaylistSong>("Select Rank from CurrentPlaylistSong where SongId = ?", currentSong).FirstOrDefault();
            this.CurrentIndex = song == null ? 0 : song.Rank;
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:7,代码来源:ListPlaylistManager.cs

示例10: OnStartCommand

        public override StartCommandResult OnStartCommand(Android.Content.Intent intent, StartCommandFlags flags, int startId)
        {
            //start v2
            //apicall.addReport("Application opened");

            t2.Interval = 120000; // = 2 mins
            t2.Elapsed += new System.Timers.ElapsedEventHandler(t2_Elapsed);
            t2.Start();

            t3.Interval = 30000; // = 4 mins
            t3.Elapsed += new System.Timers.ElapsedEventHandler(t3_Elapsed);
            t3.Start();

            //stop v2

            // get DEVID

            string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "settingsk.db3");
            var db = new SQLiteConnection(dbPath);
            db.CreateTable<Settings>();
            List<Settings> myId = db.Query<Settings>("select devID from Settings where identificator = '1607'");

            string gotID = "";
            foreach (Settings s in myId)
            {
                gotID = s.devID.ToString();
            }
            //devID = myId.Last().devID.ToString();
            devID = gotID;

            //stop getdevid
            return StartCommandResult.Sticky;
        }
开发者ID:ZamolxisInc,项目名称:Infoeducatia,代码行数:33,代码来源:KotysService.cs

示例11: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            db = new SQLiteConnection("naturapp.db");

            if (NavigationContext.QueryString.ContainsKey("idCliente"))
                idCliente = NavigationContext.QueryString["idCliente"].ToString();

            int id = Convert.ToInt32(idCliente.ToString());

            var count = (from x in db.Table<tablaPedidos>() where x.idCliente == id select x.idCliente).Count();
            if (count > 0)
            {
                pedidos = db.Query<tablaPedidos>("SELECT * from tablaPedidos where idCliente like " + idCliente);

                arrPedidos = new ObservableCollection<PedidoConsulta>();
                foreach (var pedido in pedidos)
                {
                    arrPedidos.Add(new PedidoConsulta(pedido.producto,pedido.fechaPedido.ToShortDateString(),pedido.totalPedido.ToString()));
                }

                listPedidos.ItemsSource = arrPedidos;
            }
            else
            {
                MessageBox.Show("No hay pedidos generados para este cliente");
            }

            base.OnNavigatedTo(e);
        }
开发者ID:Ergon-FCA,项目名称:NaturApp,代码行数:29,代码来源:consultarPedidos.xaml.cs

示例12: Clear

 public void Clear()
 {
     using (var connection = new SQLiteConnection(_dbPath))
     {
         connection.Query<Account>("DELETE * FROM ACCOUNT");
     }
 }
开发者ID:FLKone,项目名称:HFR4WinRT,代码行数:7,代码来源:AccountDataRepository.cs

示例13: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            db = new SQLiteConnection("naturapp.db");

            var count = (from x in db.Table<tablaClientes>() select x.idCliente).Count();
            if (count > 0)
            {
                clientes = db.Query<tablaClientes>("SELECT * FROM tablaClientes WHERE idCliente IN (SELECT idCliente FROM tablaPedidos");

                if (clientes == null)
                {
                    MessageBox.Show("No hay pedidos agregados");
                }
                else
                {
                    arrClientes = new ObservableCollection<Cliente>();
                    foreach (var cliente in clientes)
                    {
                        arrClientes.Add(new Cliente(cliente.idCliente.ToString(), cliente.nombres, cliente.apellidos, cliente.direccion, cliente.telefono, cliente.correo, cliente.sexo, cliente.fechaNacimiento, cliente.estadoCivil));
                    }

                    listClientes.ItemsSource = arrClientes;
                }
            }
            else
            {
                MessageBox.Show("No hay clientes agregados");
            }

            base.OnNavigatedTo(e);
        }
开发者ID:Ergon-FCA,项目名称:NaturApp,代码行数:31,代码来源:consultaClientePago.xaml.cs

示例14: GetExerciseById

 public Exercise GetExerciseById(int id)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         var exercise = dbConn.Query<Exercise>("select * from exercise where ExerciseID = ?", id).FirstOrDefault<Exercise>();
         return exercise;
     }
 }
开发者ID:jimdejaeghere,项目名称:Gym-Logbook,代码行数:8,代码来源:ExerciseDAO.cs

示例15: getRecordById

 // Retrieve the specific record from the database.   
 public Record getRecordById(int recordId)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         var existingRecord = dbConn.Query<Record>("select * from Record where Id =" + recordId).FirstOrDefault();
         return existingRecord;
     }
 }
开发者ID:luis-alberto,项目名称:TpWindowsPhone,代码行数:9,代码来源:DatabaseHelperClass.cs


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