碟碟 2016-04-02 03:55 采纳率: 0%
浏览 2391
已采纳

Android中SQLite数据库查询不到的问题,求大神帮忙

private static String sql1="create table user(
_id integer primary key autoincrement,
name varchar(20),
pwd varchar(20))";
private static String sql2="create table account_book("+
"_id integer primary key autoincrement,"+
"name varchar(20) not null,"+
"user_id references user(_id) not null,"+
"cash double ,"+
" disposit_card double,"+
" credit_card double,"+
"alipay double )";
private static String sql3= " create table payin("+
" _id integer primary key autoincrement,"+
"account_id references account_book(_id) not null,"+
"type varchar(20),"+
"use varchar(20),"+
"date,"+
"count integer(20),"+
"qianbao varchar(20),"+
"beizhu varchar(30) )";
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
db.execSQL(sql1);
db.execSQL(sql2);
db.execSQL(sql3);
}
以上是建表语句。
以下根据user_id 在account_book表中查询时返回的cursor中没有记录getcount=0
根据account_id在payin表中查询也是一样的情况。
下面是我的查询语句:
Cursor cursor=database.query("account_book",new String[]{"_id"},"user_id=?", new String[]{user_id+""}, null, null, null);
Cursor cursor=database.query("payin",new String[]{"_id","type","use","count","qianbao","beizhu"}, "account_id=?and type=?", new String[]{account_id.toString(),type}, null, null, "_id");
请大神解惑,拜托了

  • 写回答

2条回答 默认 最新

  • 碟碟 2016-04-02 09:01
    关注

    本人已经解决了,谢谢大家热心回答了。图片说明

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮