0
我正在创建一个数据库,我需要显示前一天的数据。如何在android sqlite中传递字符串而不是字符串参数
Long test= System.currentTimeMillis()-24*60*60;
DateFormat dateFormattest= DateFormat.getDateInstance();
String dateFilter= dateFormattest.format(test);
Log.v("initial", dateFilter);
// String[] args={dateFilter.toString()};
cursor=dba.query(Utils.Table_Name,new String[]{Utils.Id_Name,Utils.Food_Name,Utils.Calorie_Name,
Utils.Date_Name},Utils.Date_Name+"=?",new String[]{dateFilter},null,null,Utils.Date_Name+ " DESC");
// Log.v("sentvalue", args+"");
我在datefilter正确的值在 logcatbut的初始值月8,2016 但sentvalue的logcat的是Ljava.lang.String; @ 501eb6
致命异常:主 工艺:com.example.shailendra.navtest,PID:24953 java.lang.IllegalArgumentException异常:由于索引超出范围不能在索引2结合参数。该语句有1个参数。 – rishav
我想将其选为datefilter。我怎么把日期过滤器,因为它不采取datefilter参数...它要求字符串数组 – rishav
你在数据库中插入'Date_Name'的格式?您应该使用该格式作为'selectionArgs'来从数据库中进行查询。 –