sqlite3(第二十四课)

前端之家收集整理的这篇文章主要介绍了sqlite3(第二十四课)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

StudentDAOTest2.java
private static final String TAG = "StudentDAOTest";

public void testAdd() {
StudentDAO2 studentDAO2=new StudentDAO2(this.getContext());
Student student=new Student(3,"huanglw",(short)20);
studentDAO2.add(student);
Log.i(TAG,"add successed");}

StudentDAOT.java

/** * 添加学生信息StudentDAO2 * @param student */public void add(Student student){db=dbHelper.getWritableDatabase();ContentValues contentValues=new ContentValues();contentValues.put("sid",student.getSid());contentValues.put("sname",student.getSname());contentValues.put("sage",student.getSage());db.insert("t_student","sid",contentValues);}

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

猜你在找的Sqlite相关文章