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");
请大神解惑,拜托了
Android中SQLite数据库查询不到的问题,求大神帮忙
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
悬赏问题
- ¥15 模电中二极管,三极管和电容的应用
- ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
- ¥15 气象网格数据与卫星轨道数据如何匹配
- ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
- ¥15 微软账户问题不小心注销了好像
- ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
- ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
- ¥20 关于web前端如何播放二次加密m3u8视频的问题
- ¥15 使用百度地图api 位置函数报错?
- ¥15 metamask如何添加TRON自定义网络