0

I have an error in that m

     String currentDateTimeString = DateFormat.getDateInstance().format(new Date());

     Cursor myCursor=db.query(true, DATABASE_TABLE, new String[]{KEY_ROWID,MONEY_FIGURE,SPENDING_DETAILS,DATE}
             , KEY_ROWID , null,  null,  DATE+"="+currentDateTimeString,  KEY_ROWID, null);

The query function by the androids api:

query(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)

What I am trying to do here is to say. give me all the data based on where the date equals currentDateTimeString .

But I get an error on that statement.. dont ask me what the error is..when i remove the call to the method holding that query statement the error doesnt appear..so i guess it is an sqlexception

SOLVED MY ME:

 Cursor myCursor=db.query(true, DATABASE_TABLE, new String[]{KEY_ROWID,MONEY_FIGURE,SPENDING_DETAILS,DATE}
         ,DATE+"='"+currentDateTimeString+"'"  , null,  null, null ,  KEY_ROWID, null);

I am trying to do this

SELECT MONEY_FIGURE,SPENDING_DETAILS,DATE
FROM SpendingManagmentTable
WHERE Date=@ currentDateTimeString

1 Answer 1

1

If the column type is not number then have to use with ''

date='1/1/2011' not date=1/1/2011

Cursor c =  db.query(DATABASE_TABLE, new String[] {{KEY_ROWID,MONEY_FIGURE,SPENDING_DETAILS,DATE},DATE+"='"+currentDateTimeString+"'", null, null, null, null);
Sign up to request clarification or add additional context in comments.

1 Comment

still the mistake is thrown..didnt you see that it is a string.. how do i debug an android application..i tried with cat log nothing appears

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.