Dbutils 创建数据库
来源:互联网 发布:c 游戏编程教程 编辑:程序博客网 时间:2024/05/16 11:29
public class InfoDao { private DbUtils create; public InfoDao(Context context) { super(); //建库 create = DbUtils.create(context, "logininfo"); try { //建表 create.createTableIfNotExist(Info.class); } catch (DbException e) { // TODO Auto-generated catch block e.printStackTrace(); } }//添加 public void add(Info info) { try { create.save(new Info(info.getId(), info.getUser(), info.getPwd(), info.getPnum(), info.getEmail())); } catch (DbException e) { e.printStackTrace(); } } //查询 public List<Info> query(String name) { List<Info> list=new ArrayList<Info>(); try { list=create.findAll(Selector.from(Info.class).where("user","like","%"+name+"%")); } catch (DbException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; }}
package com.bwie.bean;import com.lidroid.xutils.db.annotation.Table;//改名@Table(name="user")public class Info { private int id; private String user; private String pwd; private String pnum; private String email; public Info() { super(); // TODO Auto-generated constructor stub } public Info(int id, String user, String pwd, String pnum, String email) { super(); this.id = id; this.user = user; this.pwd = pwd; this.pnum = pnum; this.email = email; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getPnum() { return pnum; } public void setPnum(String pnum) { this.pnum = pnum; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "姓名:"+user+"\n电话号码:"+pnum+"\n邮箱:"+email; }}
0 0
- Dbutils 创建数据库
- Dbutils 创建数据库
- DBUtils创建数据库,增删改查
- 数据库查询工具包 DbUtils
- 使用DbUtils访问数据库
- DbUtils操作数据库
- 数据库查询工具包 DbUtils
- DButils数据库查询
- xUtils DbUtils数据库
- dbutils操作数据库
- c3p0+DButils操作数据库
- DbUtils操作数据库
- DBUtils数据库工具类
- 利用dbutils简化数据库操作
- DbUtils操作数据库的用法
- Android DbUtils之查询数据库
- 13、使用DBUtils操作数据库
- Dbutils数据库增删改查
- 上谷歌配置文件教程
- Java面试基础部分(2)
- Android 各种Drawable子类简析
- 【数据库】oracle创建表空间、用户及导入导出
- 编程常用缩写
- Dbutils 创建数据库
- 二分查找
- 微信小程序开发资源整理
- 版本更新 导入类名UpdateTools
- 产品需求思考
- web学习
- c#多线程 Invoke方法的使用
- 最短路
- 阿里腾讯市值