请问,如何在eclipse中建立SQLite,最好能提供一下代码

解决方案 »

  1.   

    public DbHelper extends SQLiteOpenHelper{
           
           private Context context;
              //构造函数,获得上下文
            public DbHelper(Context context){
           super(context,库名,游标工厂,版本);
           
    }
       public void onCreate(SQLiteDatabase db){
           String sql={"create  table  feng (_id INTEGER primary key AUTIONINCREMENT,title text not null,content text not null )"};
           db.execSQL(sql);
    }
      pubic void onUpgrade(SQLiteDatebae db,arg1,arg2){
       db.execSQL("drop table if exists feng");
    onCreate(db);
      
    }
    }
      

  2.   

    sqlite分内存的,文件的两种方式,你如果要运行速度快,就要在android内存中建立sqlite.
    1楼提供的应该是在文件中建立sqlite的方式
      

  3.   

    1.文件sqlite的创建方法
    context对象提供的openOrCreateDatabase(String name,int mode,SQLiteDatabase.CursorFactory factory),该方法打开/创建指定名称的数据库
    文件2.内存sqlite的创建方法
    调用SQLiteDatabase的静态方法create(SQLiteDatabase.CursorFactory factory)可以
    创建内存数据库