sqlite 个人写增删改查实例

前端之家收集整理的这篇文章主要介绍了sqlite 个人写增删改查实例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
//创建数据库代码
// DbConn conn = new DbConn(MainActivity.this,"hellodb",null,1);

// conn.createTable("worldtb");

package com.oschina.osmf; import android.content.Context; import android.database.sqlite.sqliteDatabase; import android.database.sqlite.sqliteDatabase.CursorFactory; import android.database.sqlite.sqliteOpenHelper; import android.util.Log; public class DbConn extends sqliteOpenHelper{ public DbConn(Context context,String name,CursorFactory factory,int version) { super(context,name,factory,version); } @Override public void onCreate(sqliteDatabase db) { } @Override public void onUpgrade(sqliteDatabase db,int oldVersion,int newVersion) { } public void createTable(String tableName) { sqliteDatabase db = this.getWritableDatabase(); String sql = "create table if not exists "+tableName+"(id integer primary key,name varchar)"; db.execsql(sql); Log.i("test","创建表成功"); } public void selectTable(String tableName) { } }

原文链接:https://www.f2er.com/sqlite/200629.html

猜你在找的Sqlite相关文章