2016-04-17 13 views
-3

Ich bin mir nicht sicher, was mit dieser Abfragesyntax falsch ist, aber es funktioniert einfach nie. Meine Programmierung greift alle korrekten Informationen auf, scheitert jedoch an dieser Stelle. HierAndroid SQLite Abfrage Syntaxfehler CREATE_TABLE

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

ist der Fehler, die es gibt:

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

Also mir, es die richtigen Namen findet, aber es kann nicht ausgeführt werden. Ich glaube, ich habe einen Doppelpunkt oder etwas verpasst.

Vielen Dank im Voraus

EDIT: Ich habe gerade realisiert und verstehe nicht, warum der erste Kommentar sagt:

D/Database operations: Table created 

Dann heißt es:

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

Entfernen Sie die Unterdecke zwischen "CREATE" und "TABLE". –

+0

https://www.sqlite.org/lang_createtable.html –

+0

Leider hat das nicht funktioniert. Derselbe Fehler. – MrAnderson1992

Antwort

-1

dieses

Versuchen
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); "; 
+1

Das ist nicht korrekt. Bitte beachten Sie die Kommentare zu der Frage. –