我试过判断 cursor==null 和 cursor.isNull(0) 都不行啊..而且后者还报错
请教下, 有什么其他方法可以解决??
解决方案 »
- Consumer closed input channel or an error occurred. events=0x8错误
- 请教:android中httpclient重定向问题
- android服务器数据库放在哪?
- 求助通讯录
- 菜鸟请教 (7)
- 编译好的APK怎么打包进Android镜像啊?在网上找了一些方法不行,不知道为什么
- 想做一个类似于个人相册的android程序,各位大牛给个指点。
- 提问 android 互联网通讯
- 请问这种效果如何实现?
- android 屏幕分成上下两个布局,要求点击下方布局内的按钮可以换掉上方布局。
- android大家工资如何??
- Android Spinner弹出窗口,在窗口外空白区域关闭窗口
这样的话还是一直true啊... 你这个或条件跟我只有cursor==null是一样的吧?
这样一直是true?????
按照你的修改,我的代码是:cursor=cdb.rawQuery("SELECT * FROM "+current_table_name+" WHERE begin_class=? AND lasting=?",new String[]{""+beginClass,""+lasting});
if (cursor == null || cursor.getCount()<=0){
cdb.update(current_table_name,values,"begin_class="+beginClass,null);
}
else {
cdb.insert(current_table_name,null,values);
}
这样的话, 我发现不管查找结果是否为空, 都只能执行update语句, 把if-else两个语句交换过来的话,就只能执行insert, 也就是说 cursor == null || cursor.getCount()<=0 返回的结果一直为true
更新前后,把这个打印出来看看...是否变化..
{
//进行操作
}