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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:07:16+00:00 2026-06-12T09:07:16+00:00

I am using this code to delete row from Sqlite3 Database,but it’s not working,insert,update,select

  • 0

I am using this code to delete row from Sqlite3 Database,but it’s not working,insert,update,select query are working fine, but the delete statement is not working in my code

 -(void)delete{

        str=title.text;
        sqlite3_stmt *selectstmt;
        if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
            NSString *deleteSQL = [NSString stringWithFormat: @"delete from ToDo where title=\"%@\"",str];
            NSLog(@"%@",deleteSQL);
            const char *sql = [deleteSQL UTF8String];
            sqlite3_prepare_v2(database,sql, -1, &selectstmt, NULL); 
            if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) 
               NSLog(@"success");
            else
              NSAssert1(0, @"Error while creating delete statement. '%s'", sqlite3_errmsg(database));            
            }
            sqlite3_finalize(selectstmt);
            sqlite3_close(database);
        }

What am I doing wrong?

  • 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-12T09:07:16+00:00Added an answer on June 12, 2026 at 9:07 am

    you can delete particular recored from sqlite database using below code:-

    NSDictionary *d =(NSDictionary *) [YourMutableArray objectAtIndex:0];
    NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [path objectAtIndex:0];
    NSString *dbPath =[documentsDir stringByAppendingPathComponent:@"db.sqlite"];
    sqlite3_open([dbPath UTF8String], &database);
    
    if(deleteStmt == nil) 
    {
    
        NSString *deleteStatementNS = [NSString stringWithFormat:
                                       @"delete from tbl_postoffice where type = '%@'",
                                       urusniqIDentifire];
        const char *sql = [deleteStatementNS UTF8String];
    
        //const char *sql ="delete from tbl_todo where type = yourDbfildeRecored";
        if(sqlite3_prepare_v2(database, sql, -1, &deleteStmt, NULL) != SQLITE_OK)
            NSAssert1(0, @"Error while creating delete statement. '%s'", sqlite3_errmsg(database));
    }
    
    //When binding parameters, index starts from 1 and not zero.
    sqlite3_bind_text(deleteStmt, 1, [[d valueForKey:@"type"] UTF8String], -1, SQLITE_TRANSIENT);
    if (SQLITE_DONE != sqlite3_step(deleteStmt)) 
        NSAssert1(0, @"Error while deleting. '%s'", sqlite3_errmsg(database));
    
    sqlite3_reset(deleteStmt);
    

    hope its Helps for you

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

Sidebar

Related Questions

I'm using this code to delete a row in a table, but it's not
I want to delete a file into recycle bin. I using this code. SHFILEOPSTRUCT
When using this code (simplified for asking): var rows1 = (from t1 in db.TABLE1
i m using jQuery.get() to delete row from a table from a page main.php
i have a table that display a record from the database. Using this php
I have created a JTable but for some reason row selection is not working
I'm trying to add a link to delete a row from a mysql database
I want to delete a row from gridview and database - I write some
I want to delete a row from the database. I added the row to
I'm using this example to store in the database the info coming from PayPal,

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.