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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:36:13+00:00 2026-05-26T19:36:13+00:00

I am trying to retrive data from my table. But it always returns (null).

  • 0

I am trying to retrive data from my table. But it always returns (null). Here is my code

    -(NSString *)filePath
{

    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentDir=[paths objectAtIndex:0];
    return [documentDir stringByAppendingPathComponent:@"database.sql"];

}

-(void)openDB
{
    //sqlite#_open
    if(sqlite3_open([[self filePath]UTF8String], &newDB)!=SQLITE_OK)
    {
        sqlite3_close(newDB);
        NSAssert(0,@"Database fialed to open");
    }
}

-(void)readAttendeesFormeetingId:(NSInteger)mId
{

    NSLog(@"readAttendeesFormeetingId==> %d",mId);

    sqlite3_stmt *stmtAgenda=nil; 

    attendeesArray = [[NSMutableArray alloc]init];
    SQLiteConnClass *objsqlite1=[[SQLiteConnClass alloc]init];
    newdb=[objsqlite1 openDB];

    if (stmtAgenda==nil) {

        const char *sql1 = "SELECT DISTINCT name FROM MeetingAttendees where meetingId= ? AND isPresent = 1";
        if (sqlite3_prepare_v2(newdb, sql1, -1, &stmtAgenda, NULL) != SQLITE_OK) {

            NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(newdb));
        }

    }

    sqlite3_bind_int(stmtAgenda, 1, mId);

    while(sqlite3_step(stmtAgenda) == SQLITE_ROW) {

        const char *agendaTitle=(const char *)sqlite3_column_text(stmtAgenda,4);

        NSString *stragendaTitle=agendaTitle == NULL ? nil:[[NSString alloc] initWithUTF8String:agendaTitle];


        //NSString *stragendaTitle = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(stmtAgenda, 4)];

        NSLog(@"agendaTitle %@",stragendaTitle);

        [attendeesArray addObject:stragendaTitle];

        [stragendaTitle release];                       
    }

    // Reset the statement for future reuse.
    sqlite3_reset(stmtAgenda);
    sqlite3_close(newDB);
}

Here is my table structure

enter image description here

I have name values in my table. Any of the row doesn’t contain null value. Still I am getting null result.

  • 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-26T19:36:14+00:00Added an answer on May 26, 2026 at 7:36 pm

    Your SELECT statement is returning a table that has only one column (the distinct name column from MeetingAttendees), but your sqlite3_column_text call is trying to read from column index 4. Try to change the 4 to 0 and see if it returns the data you need.

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

Sidebar

Related Questions

I'm trying to retrieve hierarchical data from a table but am failing to do
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I am trying to parse a bit of data from an HTML file, but
I'm trying to move data from a selected row in a table to a
I am trying to retrieve the data from the table and convert each row
I'm trying to retrieve data from an SQL Server 2000 server, and place into
I'm trying to retrieve data from an Entity in Core Data where I know
I am trying to retrieve and use the raw data from RSS feeds. For
I have a model that I'm trying to retrieve an array of data from,
I'm trying to retrive a dataset to a Gridview, but I just don't get

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.