当我运行此代码时,会发生错误。我正在尝试创建数据库并通过修改它来学习。我从教程代码中复制了这段代码,它在示例中运行良好,但我无法运行它。你能提供更多关于为什么会发生这种情况的信息吗?
错误是:
此行有多个标记
- The type DatabaseHelper must implement the inherited abstract method SQLiteOpenHelper.onUpgrade(SQLiteDatabase,
int, int)
- The public type DatabaseHelper must be defined in its own file
- The type DatabaseHelper must implement the inherited abstract method SQLiteOpenHelper.onCreate(SQLiteDatabase)
我的代码是:
package com.example.eos;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DatabaseHelper extends SQLiteOpenHelper { //ERROR IS HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
static final String dbName="demoDB";
static final String employeeTable="Employees";
static final String colID="EmployeeID";
static final String colName="EmployeeName";
static final String colAge="Age";
static final String colDept="Dept";
static final String deptTable="Dept";
static final String colDeptID="DeptID";
static final String colDeptName="DeptName";
static final String viewEmps="ViewEmps";
public DatabaseHelper(Context context)
{
super(context, dbName, null,33);
}
}