Android SQLite查询语法错误CREATE_TABLE

时间:2016-04-17 19:10:59

标签: android sqlite android-studio

我不确定这个查询语法有什么问题,但它永远不会有效。我的编程抓取了所有正确的信息,但此时失败了。

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.example.section32point5.digiceit/com.example.section32point5.digiceit.CameraActivity}: android.database.sqlite.SQLiteException: near "CREATE_TABLE": syntax error (code 1): , while compiling: CREATE_TABLE receipts_table(receipt_ID STRING,receipt_FILE STRING,receipt_IMAGE STRING);

以下是它给出的错误:

D/Database operations: Table created

所以对我来说,它找到了正确的名称但却无法运行它。我猜我错过了冒号或什么。

提前致谢

编辑:我刚刚意识到并且不明白为什么第一条评论说:

E/SQLiteLog: (1) near "CREATETABLE": syntax error

然后它说:

  public java.util.ArrayList<E> getPath(E e) 
{
  TreeNode<E> current = getNode(e);
  java.util.ArrayList<E> path = new java.util.ArrayList<>();

  while(current != null)
  {
      path.add(current.element);
      current = current.parent;

  }
  return path;
}

1 个答案:

答案 0 :(得分:-1)

试试这个

public String CREATE_QUERY = " CREATE_TABLE " + ReceiptsTable.TableInformation.TABLE_NAME + " ( " + ReceiptsTable.TableInformation.RECEIPT_ID + " STRING, " + ReceiptsTable.TableInformation.RECEIPT_FILE + " STRING, " +ReceiptsTable.TableInformation.RECEIPT_URI + " STRING); ";