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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:11:32+00:00 2026-06-18T15:11:32+00:00

I have database, but when i tried to remove data from the database nothing

  • 0

I have database, but when i tried to remove data from the database nothing happens, what should i do to make sure it works? Because when i pressed delete the dta is still in the database

This is the code:

/file path to database
    -(NSString*)filePath {
        NSArray*paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        return [[paths objectAtIndex:0]stringByAppendingPathComponent:@"bp.sql"];
    }

    //open database
    -(void)openDB {

        if(sqlite3_open([[self filePath]UTF8String], &db) !=SQLITE_OK) {
            sqlite3_close(db);
            NSAssert(0, @"Databese failed to open");
        }

        else {
            NSLog(@"database opemed");
        }


    }


    - (IBAction)del:(id)sender {

        NSString*sql = [NSString stringWithFormat:@"DELETE key, theDate, customer, code1, code2 FROM summary WHERE key=\"%@\"",customerName];
        const char* query_stmt = [sql UTF8String];
        sqlite3_stmt*statement;

        sqlite3_prepare_v2(db, query_stmt, -1, & statement, NULL);
        if (sqlite3_step(statement) == SQLITE_DONE)
        {
           NSAssert(0, @"database object delete failed");

        } else {
            NSLog(@"No error");

        }
        sqlite3_finalize(statement);
        sqlite3_close(db)
  • 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-18T15:11:34+00:00Added an answer on June 18, 2026 at 3:11 pm

    You can’t delete specific column values using the DELETE query. It’s for removing the entire row.

    enter image description here

    The problem is with the following query:

    NSString*sql = [NSString stringWithFormat:@"DELETE key, theDate, customer, code1, code2 FROM summary WHERE key=\"%@\"",customerName];
    

    Change it to:

    NSString*sql = [NSString stringWithFormat:@"DELETE FROM summary WHERE key=\"%@\"",customerName];
    

    If you need to remove particular column value of a row use the UPDATE query.

    Please check the sqlite documentation for the details

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

Sidebar

Related Questions

There is large website all data comes from database , I want to remove
I have been tasked with porting data from a MongoDB database to a MySQL
I have data coming from an nvarchar field of the SQL server database via
I have setup multiple SQL Service Broker Queues in a database but have not
I have a strong database background but very little practical experience with ms sql
I have taken the backup of mysql database but when I am trying to
I have done inserting a record into database but I don't know how to
I have a form that saves the price into the database but whn a
Let's say I have a user that entered 12 links into the database but
I need to modify a column in a SQLite database but I have to

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.