public class MyDataBase extends SQLiteOpenHelper {
public MyDataBase(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table tableregimage(int userid number autoincrement,username text,useraddress text,usercontact text,image blob);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
答案 0 :(得分:1)
此方法可帮助您插入记录:
void addContact(String Name,String Contact,String Image) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_NAME, Name );
values.put(KEY_CONTACT, Contact);
values.put(KEY_IMAGE, Image)
// Inserting Row
db.insert(TABLE_CName, null, values);
db.close(); // Closing database connection
}