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 8076479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:16:08+00:00 2026-06-05T15:16:08+00:00

I am new to using SQLite databases and android mobile development. I am trying

  • 0

I am new to using SQLite databases and android mobile development. I am trying to check if the username entered by a edit text field exists in the database. When I run it and click a button, the application crashes. This is my code.

 public boolean findUsername(String username) {
Cursor c = ourDatabase.query(true, DATABASE_TABLE_L, new String[] {
        KEY_USERID, KEY_USERNAME, KEY_PASSWORD,KEY_SECRETQ,KEY_ANSWER}, KEY_USERNAME + "="
        + username, null, null, null, null, null);
    if (c != null) {
      return true;
      }
      return false;
  }
}

The error from the log cat states that:

no such column: bobby: , while compiling: SELECT DISTINCT userId, username, password,    secretQ, answer FROM Login WHERE username=bobby

What am I doing wrong?

  • 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-05T15:16:09+00:00Added an answer on June 5, 2026 at 3:16 pm

    You should form your query like this

    SELECT DISTINCT userId, username, password,    secretQ, answer FROM Login WHERE username='bobby'
    

    You have to put quotes to username.

    Cursor c = ourDatabase.query(true, DATABASE_TABLE_L, new String[] {
            KEY_USERID, KEY_USERNAME, KEY_PASSWORD,KEY_SECRETQ,KEY_ANSWER}, KEY_USERNAME + "='"
            + username +"'", null, null, null, null, null);
    

    Try above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to android development. Now im trying to use sqlite db. I created
I followed a tutorial on how to handle SQLite databases using the android SDK.
I am relatively new to using SQLite on Android. I have some experience with
I'm new and trying to create a login activity (username & password) in android.
I use SQLite in android development. When I insert a row using insert, I
I'm trying to test a simple SQLite database using Robolectric in my Android application.
I am new to using the SQLite database in iphone apps. I have created
Am new to SQLite using in iPhone. I have used google and got some
I have started using SqLite recently, so I am relatively new to it. I
currently I am using: $result = new SQLite3(sprintf(users/USERIDS_DB.sqlite)); $numRows = $result->exec (SELECT count(*) FROM

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.