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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:48:29+00:00 2026-05-30T20:48:29+00:00

I have worked on sample application for insert the data into SqliteDb and try

  • 0

I have worked on sample application for insert the data into SqliteDb and try for get the first row first column value from the database(first cell value).
I have implemented code for store the data into data base as follows:

private SQLiteDatabase sqLiteDatabase;

 //create table MY_DATABASE (ID integer primary key, Content text not null);
private static final String SCRIPT_CREATE_DATABASE =
"create table " + MYDATABASE_TABLE + " ("
+ KEY_ID + " integer primary key autoincrement, "
+ KEY_CONTENT1 + " text not null, "
+ KEY_CONTENT2 + " text not null);";

to insert the data

public long insert(String content1, String content2){

ContentValues contentValues = new ContentValues();
contentValues.put(KEY_CONTENT1, content1);
contentValues.put(KEY_CONTENT2, content2);

return sqLiteDatabase.insert(MYDATABASE_TABLE, null, contentValues);
} 

from the above code i can able to save the data in db but how can i get the last inserted KEY_CONTENT1 value from the same DB?

please any body help me

  • 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-30T20:48:30+00:00Added an answer on May 30, 2026 at 8:48 pm

    The return value of insert() is the row id you just created. Use that to query for the KEY_CONTENT1. This would be the saves way (much more secure than a temporary variable to store the value of KEY_CONTENT1)

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

Sidebar

Related Questions

I have worked on iPhone application but not aware of the formalities to submit
I have an ASP.NET MVC application with pages where the content is loaded into
I have worked on a simple application. It application includes diffrent levels that can
We have a legacy VB6 application which has worked just fine on Windows XP
In our application we use the repository pattern to retrieve and persist data from
I have an application which uses JTables to display data, and the cells are
I got the sample code from Facebook to post a message. At first it
I have written a sample console application to test backgroundworker using one of the
I have written a very simple WCF service, that worked fine (code below), then
I have worked for 5 years mainly in java desktop applications accessing Oracle databases

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.