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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:23:50+00:00 2026-06-04T09:23:50+00:00

I have a s3db database in SQLite. Now I want to attach or open

  • 0

I have a s3db database in SQLite. Now I want to attach or open it in the application? Please tell me what code needs to be written to connect to the database?

  • 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-04T09:23:51+00:00Added an answer on June 4, 2026 at 9:23 am

    I will give u an example with the help of that u can easily understand how can we show the data from the database on a textview. Below is the code in which the testdata is the name of the database which have user table in which 2 columns are present. i show the data of these 2 columns on 2 diff. textviews.

    public class high_score extends Activity{
    SQLiteDatabase mydatabase=null;
    String Data="";
    String Data1="";
    String TableName="users";
    
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.high_score);
    
    
    
    
            RelativeLayout main=(RelativeLayout)findViewById(R.id.main);
    
            try
            {
                mydatabase=this.openOrCreateDatabase("testdata", MODE_PRIVATE, null);
    
                Cursor c=mydatabase.rawQuery("SELECT DISTINCT name,score FROM "+TableName+" , null);
                int column1=c.getColumnIndex("name");
                int column2=c.getColumnIndex("max_score");
                c.moveToFirst();
                if(c!=null)
                {   
                    do
                    {
                        String Name=c.getString(column1);
                        int Score=c.getInt(column2);
                        Data=Data+Name+"\n";
                        Data1=Data1+Score+"\n";
                        System.out.println("name"+Name+" score"+Score);
                    }while(c.moveToNext());
                    TextView tv=(TextView)findViewById(R.id.tv);
                    TextView points=(TextView)findViewById(R.id.points);
                    tv.setText(Data);
                    points.setText(Data1);
                    setContentView(main);
    
                    }
    
                 /*TextView tv=(TextView)findViewById(R.id.tv);
                tv.setText(Data);
                setContentView(tv);*/
    
            }catch(Exception ex)
            {
                Log.e("ERROR","ERROR" ,ex);
            }
            finally
            {
                if(mydatabase!=null)
                    mydatabase.close();
            }
    

    you can easily access the data like this

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

Sidebar

Related Questions

I have inserted a lot of information into a SQlite database from my program.
Have written all the code in a silverlight class library (dll) and linked this
I'm getting System.Data.SQLite.SQLiteException: Unable to open the database file. when I attempt to access
I have created a database using the SQLite administrator. It contains 3 tables and
Have a matrix report now that has Position, Hours and Wages for a location
Have you ever obfuscated your code before? Are there ever legitimate reasons to do
Have you ever created or encountered a self modifying code in Java? If yes,
I am trying to connect to a sqllite db from with a c# application.
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm

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.