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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:35:00+00:00 2026-06-17T15:35:00+00:00

Here is my code: It works for other methods but creating an issue here

  • 0

Here is my code:
It works for other methods but creating an issue here only.
Here I am unable to insert data…
What is the problem here?Code was working earlier perfectly.

-(void) insertleadership {
[self trunleadership];
// Setup the database object
sqlite3 *database;
NSLog(@"Inside leadership");
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
    // Setup the SQL Statement and compile it for faster access
    // NSString *query=[stringWithFormat: @"select name,password from customer where name=%@ and password=%@",*login_name,*login_pass];
    sqlite3_stmt *compiledStatement;
    for(int i=0;i<ltitle.count;i++)
    {
        // NSString *insertSQL = [NSString stringWithFormat:@"insert into category values(\'aa\',\'bb\',\'cc\',\'cc\',\'cc\')"];
        // NSLog(@"Inside leadership");
        NSString *insertSQL = [NSString stringWithFormat:@"insert into leadership values(\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\',\'%@\')",[ltitle objectAtIndex:i],[ldate objectAtIndex:i],[lfunction objectAtIndex:i],[lservice objectAtIndex:i],[lsubservice objectAtIndex:i],[labstract objectAtIndex:i],[ldoctype objectAtIndex:i],[lcreated objectAtIndex:i],[lcorridor objectAtIndex:i],[lfeature objectAtIndex:i],[lindiastory objectAtIndex:i],[lpublish objectAtIndex:i],[ltopic objectAtIndex:i]];
        // NSLog(@"SQL Query for leader:%@",insertSQL);
        const char *insert_stmt = [insertSQL UTF8String];
        // sqlite3_prepare_v2(databaseName, insert_stmt, -1, &statement, NULL);
        sqlite3_prepare_v2(database, insert_stmt, -1, &compiledStatement, NULL);
        if(sqlite3_step(compiledStatement) == SQLITE_DONE){
            NSLog(@"Insert into leadership successful");
        }
        else {
            NSLog(@"Unable to insert in leadership");
        }
        // Release the compiled statement from memory
        sqlite3_finalize(compiledStatement);
    }
    sqlite3_close(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-17T15:35:01+00:00Added an answer on June 17, 2026 at 3:35 pm

    If you add some reporting to your code, sqlite itself will tell you why it’s not opening:

    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
    {
        // Do something
        splite3_close(database);
    }
    else
    {
        NSLog(@"Failed to open database '%@': %s", databasePath, sqlite3_errmsg(database));
    }
    

    Also @HotLicks is correct in that you should be copying the database out of the app bundle before you access it, unless you open it readonly (by using sqlite3_open_v2() and passing in SQLITE_OPEN_READONLY as one of the flags).

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

Sidebar

Related Questions

I have some code here which works perfectly in firefox but not in chrome
I've got some code here that works great on IPv4 machines, but on our
Site here . Why is it that the code works for $('#club').change(function(event) but not
My code here works fine to get the content length, and tells me how
I want to create a dynamic Expression<Func<T,Y>> . Here is the code which works
here is my old code which works: $('.logo').hover(function(){ $(this).addClass('animated swing')}, function(){$(this).removeClass('animated swing') }); here
I have my code here, it works fine from my home, where my user
Here is a code excerpt from AspComet project that works with Autofac. public MessageBus(IClientRepository
Here is the code in a function I'm trying to revise. This example works
I have a little bit of Javascript that almost works correctly. Here's the code:

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.