-3

I am not sure what is wrong with this query syntax but it just never works. My programming grabs all the correct info but fails at this point.

    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);";

Here is the error that it gives:

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);

So to me, it finds the right names but cannot run it. Im guessing ive missed a colon or something.

Thanks in advance

EDIT: I just realised and don't understand why the first comment says:

D/Database operations: Table created

Then it says:

E/SQLiteLog: (1) near "CREATETABLE": syntax error
MrAnderson1992
  • 399
  • 1
  • 3
  • 11

1 Answers1

-1

Try this

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); ";
Nguyễn Trung Hiếu
  • 2,004
  • 1
  • 10
  • 22