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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:28:10+00:00 2026-06-01T03:28:10+00:00

How to retrieve value from database of SQLite onto UILabel but not in UITableView

  • 0

How to retrieve value from database of SQLite onto UILabel but not in UITableView of UIView in iPhone?

If I want to show on UITableView this code is working fine but if I change one line of code to show the value on UILabel which is in UIView the project is crashes.

The code is here, please check it.

appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
Base *baseObjects = [[Base alloc] init];

[Base getInitialDataToDisplay:[self getDBPath]];


label1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 10, 350, 65)];
label1.backgroundColor = [UIColor grayColor];


label1.text = baseObjects.tLabel;  //String to  Retrieve  but crash
label1.font = [UIFont fontWithName:@"Arial-BoldMT" size:30.0];
label1.text =@"";
label1.textColor = [UIColor blackColor];
label1.textAlignment = UITextAlignmentCenter;
[self.view addSubview:label1];
}


+ (void) getInitialDataToDisplay:(NSString *)dbPath {


AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];



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

const char *sql = "select formId,    tLabel,Fname,Mname from addEdit";

sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {

[appDelegate.baseArray removeAllObjects];
while(sqlite3_step(selectstmt) == SQLITE_ROW) {

NSInteger primaryKey = sqlite3_column_int(selectstmt, 0);

Base *baseObjects = [[Base alloc] initWithPrimaryKey:primaryKey];



baseObjects.tLabel = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 1)];


baseObjects.Fname= [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 2)];
baseObjects.isDirty = NO;
[appDelegate.baseArray addObject:baseObjects];
[baseObjects release];
}

}
else
sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.
}
  • 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-01T03:28:12+00:00Added an answer on June 1, 2026 at 3:28 am

    @Samina when you display it on tableview it works fine and you are saying that you NSLog it shows null value so how you display it on tableview cell and can you post the Base class code

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

Sidebar

Related Questions

I am able to retrieve information from a SQLite database in PHP, but not
I want to retrieve values from SQLite database in my Android application. Here in
this is my xml file,i do not known how to retrieve value from xml
When I retrieve any Scalar value from the database, I usually write code like
I use this code to read data from sqlite database: keyFromSql = [NSString stringWithCString:(char
Is there a way I could retrieve created_at value from the Database in Rails?
i need to retrieve value from existing database through phonegap.How to do it?
I m trying to store and retrieve image and text from sqlite database..My saveDatabase
I'm using CF to retrieve values from a database that are then being stored
I have next problem, when I'm trying to retrieve value from xforms:select elements I

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.