SQLiteCommand 的變數定義自行參考 SQLite.Net 的 Help
以下例子,查詢資料利用Messageshow的方式顯示查詢結果
由於此例只有兩欄,所以就只有 get 0 和 get 1
     public void GetDataFromAccountTable(SQLiteCommand cmd)
     {
         // Set command 
         cmd.CommandText = "SELECT * FROM [tbl]";
         /// CommandBehavior -> using System.Data;
            /// Read all information
         using (SQLiteDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
         {
             /// Read information by each record
                /// GetValue(by index), the index is begin 0 to the number of Field-1
             while (dr.Read())
             {
                 MessageBox.Show("第"+ dr.GetValue(0)+" 條:" +  dr.GetValue(1));
             }
         }                 
      
      
     }
 
沒有留言:
張貼留言