您好我要创建SQLite database
并插入记录。但是我的数据库没有创建。
以下是代码。不明白为什么。试了很久
如果有人可以帮助它,那么
public class DatabaseHelper extends SQLiteOpenHelper{
static final String dbName="MyDatabase";
public DatabaseHelper(Context context) {
super(context, dbName, null,33);
}
@Override
public void onCreate(SQLiteDatabase db) {
String qry = "CREATE TABLE DEPT(dept_id INTEGER PRIMARY KEY, deptName TEXT)";
db.execSQL(qry);
}
}
我正在调用像这样的构造函数
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DatabaseHelper dp = new DatabaseHelper(this);
Toast.makeText(this, "Finish Execution", Toast.LENGTH_LONG).show();
}
}