我正在使用SQLite在我的android项目中创建一个两个表,但是第二个表Uploadbook没有创建
代码:
public class DBConnection extends SQLiteOpenHelper {
public static final String DbName="MyProject.db";
SQLiteDatabase db;
public DBConnection(Context context){
super(context,DbName,null,1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table IF NOT EXISTS UploadBook(BId INTEGER primary key AUTOINCREMENT,Bname TEXT,Bcategory TEXT,AuthorName TEXT,Bdecs TEXT, Brate REAL, country TEXT, city TEXT, address TEXT, phoneno INTEGER, Email Text, Bprice REAL, Brent REAL, Bdeposit REAL, Bimage BLOB ,FOREIGN KEY (Email) REFERENCES signup(Email))");
db.execSQL("create table IF NOT EXISTS signup(ID INTEGER PRIMARY KEY AUTOINCREMENT,Name TEXT,Email TEXT,Password TEXT,REpassword TEXT)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("Drop table if EXISTS UploadBook");
db.execSQL("DROP TABLE IF EXISTS signup");
onCreate(db);
}