I'm trying to make an SQLite database inside of my Android App for some work and I'm getting an error
Error:(29, 24) error: unexpected type
required: variable
found: value
I get this error on Line 29
String query = "CREATE TABLE " = TABLE_CONCERTS + "( " +
Any ideas? Thanks I'm new to all this so not very knowledgeable. I know that date and price shouldn't be a string but I was receiving errors on Date saying required Java.Util.Date found Java.lang.string
package com.test.test.app;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.Cursor;
import android.content.Context;
import android.content.ContentValues;
import java.util.Date;
public class MyDBHandler extends SQLiteOpenHelper{
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "Concerts.db";
public static final String TABLE_CONCERT = "Concerts";
public static final String COLUMN_ID = "_id";
public static final String COLUMN_VENUE = "_concertvenue";
public static final String COLUMN_DATE = "_concertdate";
public static final String COLUMN_PRICE = "_concertprice";
public static final String COLUMN_COMMENTS = "_concertcomments";
public MyDBHandler(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, DATABASE_NAME, factory, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String query = "CREATE TABLE " = TABLE_CONCERT + "(" +
COLUMN_ID + " INTERGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_VENUE + " TEXT" +
COLUMN_DATE + " NUMBER " +
COLUMN_PRICE + " NUMBER " +
COLUMN_COMMENTS + " TEXT " +
");";
db.execSQL(query);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
Aucun commentaire:
Enregistrer un commentaire