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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:50:14+00:00 2026-05-15T07:50:14+00:00

I successfully created the Database and inserted a row however I cannot Query it

  • 0

I successfully created the Database and inserted a row however I cannot Query it for some reason. My Droid crashes everytime.

          // Create a new row of values to insert.
          ContentValues newValues = new ContentValues();
          // Assign values for each row.
          newValues.put("value", "kunjan");
          // Insert the row into your table
          myDatabase.insert(DATABASE_TABLE, null, newValues);

          String[] result_columns = new String[] { "value" };

          // I GET AN EXCEPTION HERE
          Cursor allRows = myDatabase.query(true, DATABASE_TABLE, result_columns, null, null,
              null, null, null, null);

          if (allRows.moveToFirst()) {
            String value = allRows.getString(0);
            TextView foo = (TextView) findViewById(R.id.TextView01);
            foo.setText(value);
          }

          allRows.close();
          myDatabase.close();

I get this exception

no such column: value: , while compiling: SELECT DISTINCT value FROM mainTable
  • 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-05-15T07:50:14+00:00Added an answer on May 15, 2026 at 7:50 am

    Some of the problems with the original post

    • Creating a table that has already been created. I wrote “if not exists” in the “create table” instruction.
    • Not handling Exceptions properly. I got a lot of exceptions in the creation of the table, quering it etc. I sorrounded all these operations with try-catch
    • Using hard coded values for Column names – This made it harder to verify if I was querying the column that I had created.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully created Web Services from MySQL Database using Netbeans tutorial . However,
I have successfully created a db in Matlab using the Visual Query builder (database
I successfully created database on my local server using Code First, migrated it to
I have successfully created an application which is workable on the >3.0 devices. However,
i have created table using Sqlite3.and also inserted record in that table.its running successfully.but
Using SQL Server 2000 I make a trigger in new database CREATE TRIGGER [CARDEVENTSAVING]
I have successfully created a database and performed my first migration using: class CreateUsers
currently i create dynamic database using CreateDatabase() method in Entity Framework. it executes sucessfully
I successfully created a project using Wicket quickstart and turned it into an Eclipse
I have successfully created a feature in sharepoint that modifies the existing edit dialog

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.