Hello Monica,
It seems the query is not correct. Missing quotes for WHERE_MONTH_YEAR
The correct query needs to treat WHERE_MONTH_YEAR as variable. It
should look like as follows:
return mDb.rawQuery("select t_date from finance " + where t_month=
+"\'" + selectedMonth + "\' and " + t_year = '"" + selectedYear+"'",
null);
Hope this would resolve your problem.
ag
On May 3, 4:58 pm, Monica Chrismawati <[email protected]>
wrote:
> Hi all,
>
> currently develop an application and when I catch data from database,
> the record always incomplete.
> I am curios whether this is because I use distinct, but when removed
> distinct, the incomplete result also come too.
> For the example I query to get all dates using rawQuery:
>
> public Cursor getAllDates(String selectedMonth, String selectedYear){
>
> String WHERE_MONTH_YEAR = "t_month = '"+selectedMonth+"' and
> t_year='" + selectedYear+"'";
> return mDb.rawQuery("select t_date from finance where
> t_month='"+selectedMonth+"' and t_year = '"+selectedYear+"'", null);
>
> }
>
> the call method for the example: getAllDates("June", "2010");
>
> when the query execute using command line with query:" select t_date
> from finance where t_month='June' and t_year='2010';
>
> the result should be:
> 7
> 8
>
> but in the emulator I get only 8.
>
> Anybody ever got issue like this? This is because of what? Somebody
> please help me, thanks a lot.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en