Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:43:49+00:00 2026-06-05T17:43:49+00:00

Actually I am working on this for the last 3 or 4 weeks but

  • 0

Actually I am working on this for the last 3 or 4 weeks but have not able to resolve it.
I am working on Sqlite Database in android in which I have used a date picker control in my activity Once a user sets a date then i’ll stored the date into the string and then sends it to the database it is working fine but when i tried to retrieve the date on the basis of date set on date picker control then it doesn’t give me the desired output it show the only a line which is opening a database on my catlog.

Database Class

//Table Definition with Columns
private static final String CREATE_MYCOMPANY =
    "create table company " + " (" + "_id" + " integer primary key autoincrement, "
    + "company_date" +" date);";


//Insert Method
public long create(String str) {

    ContentValues args = new ContentValues();
    args.put(KEY_COMPANY_DATE, str);

    return mDb.insert(MYCOMPANY, null,args);
}




//Method For Fetching the row on the basis of Date.//
    public Cursor fetchdate(String datr) throws SQLException, ParseException {

    Cursor mCursor =
        mDb.query(true, MYCOMPANY, new String[] {KEY_COMPANY_ID,
                KEY_COMPANY_DATE}, KEY_COMPANY_DATE /*+" BETWEEN date('2012-6-10') AND date('2012-6-14')"*/ 
                 + " = " + datr, null,
                null, null, null, null);

    if (mCursor != null) {
        mCursor.moveToFirst();
    }


    return mCursor;

}

Activity Class Code

//Date picker 
DatePicker  dt = (DatePicker)findViewById(R.id.datePicker1);

//Converting the Date into the string format  
String day = String.valueOf(dt.getYear())+"-" +String.valueOf(dt.getMonth() + 1)
            +"-"+String.valueOf(dt.getDayOfMonth());


//Method for displaying the rows of table on date basis
public void DisplayAllCmpData(){

        employeeTable.open();
        try{
          Cursor c = employeeTable.fetchdate("2012-6-13");
          if (c.moveToFirst())
           {
             do {
              System.out.println("bool2");
                 DisplayCmpTitle(c);
                } while (c.moveToNext());
           }
         }catch(Exception e){
        System.out.println(e);
     Toast.makeText(this,e.toString(),Toast.LENGTH_LONG).show();
           }
         employeeTable.close();
    }

//Function For Displaying the all record.//    
    public void DisplayCmpTitle(Cursor c)
    { 

    System.out.println("bool");
       Toast.makeText(this,
           "ID: " + c.getString(0) + "\n" +
           "DATE: " + c.getString(1)
           , Toast.LENGTH_LONG).show();

    }

Thanks for any help in advance!!!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:43:51+00:00Added an answer on June 5, 2026 at 5:43 pm
    mDb.query(true, MYCOMPANY, new String[] {KEY_COMPANY_ID,
                    KEY_COMPANY_DATE}, KEY_COMPANY_DATE /*+" BETWEEN date('2012-6-10') AND date('2012-6-14')"*/ 
                     + " = '" + datr+"'", null,
                    null, null, null, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I actually have this working, but its very ugly, and its keeping me awake
I have tried to get this function working in the desired way but not
I am working on this project: http://www.e-pedkelnes.beta.verskis.lt/ Actually what I have to do is
Actually I'm working on simple project MVC4 + EF in which I have relation
actually I can not find an exact title for this problem. But I can
I have been working on Flex for last couple of months and as this
I'm actually working with a multi threaded program which involves lots of mysql operations,
I have these two statements : printf(%u,a+1); and printf(%u,(int *)a+1); Actually I was working
Actually I have a file . I am working in linux environment. I need
I apologize for this school-book question but I've been working on this SQL query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.