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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:20:34+00:00 2026-06-02T17:20:34+00:00

I develop an application in which I need to delete the rows from array

  • 0

I develop an application in which I need to delete the rows from array as well as database..?In cellForRowAtIndexPath I write like cell.textLabel.Text=[myarray.objectAtIndexPath.row]; I Want to delete that row from database and array also.In Editing method I write the code like

MoneyAppDelegate *mydelegate=(MoneyAppDelegate *)[[UIApplication sharedApplication]delegate];

if (editingStyle == UITableViewCellEditingStyleDelete) 
    {
        database *objdata=[[database alloc]init];
        [app deleteCategory:objdata];        
        [self.mytableview deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}  

But it not work. In deletecategory method I have code like

-(void)deleteCategory:(database *)databaseObj
{
[databaseObj deleteCategory];
 [myarray removeObject:databaseObj];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

MoneyAppDelegate *app = (MoneyAppDelegate *)[[UIApplication sharedApplication]delegate];

static NSString *CellIdentifier = @”Cell”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}

  cell.textLabel.text = [app.myarray4 objectAtIndex:indexPath.row];

return cell;}

deletecategory is the method to delete the record from Database.nothing else.
How can i delete that selected row from database I know its very simple but yet I confused..thnanx in advance:)

  • 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-02T17:20:35+00:00Added an answer on June 2, 2026 at 5:20 pm

    Try like this-

    - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
    {
     return UITableViewCellEditingStyleDelete;
    }
    
    -(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
    {
    [self delBtnPressed:indexPath.row];
    }
    

    //here you place your code-

    -(void)delBtnPressed:(int)sender
     {  
    NSString *titleStr=@"";
        NSString *table=@"";
    NSString *attribute=@"";
    
    sqlite3 *database;
    
    if(![titleStr isEqualToString:@""])
    {
        //-------------------------------deletion-------------------------  
    
        if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) 
        {
    
            NSString *  sqlStatement = [NSString stringWithFormat:@"delete from %@ where %@='%@' ",table,attribute,titleStr];
    
            if (sqlite3_exec(database, [sqlStatement cStringUsingEncoding:NSUTF8StringEncoding], NULL, NULL, NULL)  == SQLITE_OK)
            {
    
                [yourArr removeAllObjects];
                [self fetchAgain]; //here you need to fetch all records from DB and fill the yourArr again.
                [tblView reloadData];
    
            }
            sqlite3_close(database);
    
        }
    
    }
    else 
    {
        NSLog(@"Error while deleting please try again");
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to develop an Android application which will have a local database.
I need to develop an application which can access an SQL Server database stored
I am trying to develop a web application for which I need to capture
I need to develop an android application which do some image processing on the
We need to develop an application which is going to be installed on Virtual
I plan to develop a web application for which I need to decide the
I need to develop an iPhone/iPod application which runs in the background and can
I need to develop an application, which adds telephone numbers to existing or new
I develop an application which has several tasks like report generator, show history etc,
My company is looking to develop an iOS application which would need to make

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.