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

  • Home
  • SEARCH
  • 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 6046757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:16:36+00:00 2026-05-23T07:16:36+00:00

I am making a small iPhone application in which I have implemented the database

  • 0

I am making a small iPhone application in which I have implemented the database concept which is used to store name, contact no, email id. I Want that whenever I user save any contact It get displayed on table view. In -(IBAction)retriveall:(id)sender action I am retriving all the data from database and storing it into array. Now I want to display all the data in tableview.

How can I do this? Please help me.

-(IBAction)retriveall:(id)sender
{
    [self retrive2];
    for (int i =0; i< [namearray count]; i++) 
    {
        NSLog(@"Name is:%@",[namearray objectAtIndex:i]);
        NSLog(@"Password is:%@",[passarray objectAtIndex:i]);
    }
}



-(IBAction)retrive:(id)sender
{
    [self retrive1];
    two.text = databasecolorvalue;
    UIAlertView  *favAlert=[[UIAlertView alloc] initWithTitle:@"" message:@"Retrived" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];        
    [favAlert show];
    [favAlert release]; 
}

-(void)retrive1
{

    databaseName = @"med.sqlite";

    NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [documentPaths objectAtIndex:0];
    databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

    @try {

        if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {

            const char *sqlStatement="select pswd from Login where username = ? ";
            sqlite3_stmt *compiledStatement;

            if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {

                // Loop through the results and add them to the feeds array
                // Create a new animal object with the data from the database
                sqlite3_bind_text(compiledStatement, 1, [one.text UTF8String], -1, SQLITE_TRANSIENT);

                while(sqlite3_step(compiledStatement) == SQLITE_ROW) {

                    databasecolorvalue  =[NSString stringWithUTF8String:(char*)sqlite3_column_text(compiledStatement,0)];

                }

            }
            // Release the compiled statement from memory
            sqlite3_finalize(compiledStatement);

        }
        sqlite3_close(database);
    }
    @catch (NSException * ex) {
        @throw ex;
    }
    @finally {
    }


}
  • 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-23T07:16:36+00:00Added an answer on May 23, 2026 at 7:16 am

    You should declare an mutable array as an instance variable something like,

    NSMutableArray * colors;
    

    Initialize it in the viewDidLoad method and later alter your retrive1 method to add to the colors array.

    -(void)retrive1
    {
        /* Clearing existing values for newer ones */
        [colors removeAllObjects]
    
        /* Get database path */
    
        @try {
              [..]
                    while(sqlite3_step(compiledStatement) == SQLITE_ROW) { 
                        [colors addObject:[NSString stringWithUTF8String:(char*)sqlite3_column_text(compiledStatement,0)]];
                    }
    
              [..]
        }
        @catch (NSException * ex) { @throw ex; }
        @finally { }
    }
    

    And you’ll have to implement the rest of the table view methods in the usual manner using the array as the source.

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

Sidebar

Related Questions

I'm making a small web application in Seaside. I have a login component, and
Making a small WCF test program which is based on a Store that has
I have an iphone application but i want to make it run on ipad
I am making a small Windows Phone 7 application and have lots of text
I'm making a small asp.net mvc app. in which I have to compute data
While making some small changes to a Web application which is deployed in a
I'm making a small quiz-application in Flash (and ActionScript 3). Decided to use the
I'm making a small tool application that user can minimize in the taskbar .
I am going to be making a small user system but I have questions.
I'm writing an iPhone application which uses UIView with a CAEAGLayer as its layer.

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.