2011-09-29 74 views
1

我有一個問題。SQLite - 選擇和整數類型

我想訪問SQLite表中的特定寄存器。

String[] campos = new String[] {"codInterno"}; 
      String[] arg2 = new String[] {strId}; 

      Cursor c = db.query("Incidentes", campos, "codReg=?", arg2, null, null, null); 

所以我需要註冊字段codInterno其中codReg = strId ......多數民衆贊成沒有問題。

現在我想訪問一個特定的寄存器,我必須把codInterno - 1,並使用選擇訪問codInterno = codInterno - 1 ..這個字段是一個整數,並且總是當我必須使用一個條件,我必須使用一個字符串數組。

我怎樣才能把一個整型參數作爲條件在SELECT中?

+0

你是否嘗試過,但'敏+「」'字符串數組中? – Knickedi

回答

0

在你arg2的參數,你應該使用類似

String arg2[] = new { stdId, Integer.toString(codInterno) };