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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:09:40+00:00 2026-06-04T08:09:40+00:00

I created a table named dept in sqlite manually that has username (as Varchar)

  • 0

I created a table named “dept” in sqlite manually that has username (as Varchar) and Password (as Integer).

I used the following code to update a table

NSString *database2=[[NSBundle mainBundle]pathForResource:@"deptDatabase" ofType:@"sqlite"];
NSString *databasePath2=[NSString stringWithFormat:@"%@",database2];

const char *dbPath=[databasePath2 UTF8String];
if (sqlite3_open(dbPath, &dbHandler)==SQLITE_OK) {
    NSLog(@"database Opened");
    const char* updateQuery="update dept set password=1234 where username='suren'";
    sqlite3_stmt *stmt;
    if (sqlite3_prepare_v2(dbHandler, updateQuery, -1, &stmt, NULL)==SQLITE_OK) {
        NSLog(@"Query Executed");
    }
}

sqlite3_close(dbHandler);

but the table seems to be not updating.
Can anyone pls tell me how to update the table by altering the above code.
Thanks 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-04T08:09:41+00:00Added an answer on June 4, 2026 at 8:09 am

    You can’t not update fils in the mainBundle, these files are readonly.

    To make changes to the database, you will have to copy it to the document directory.
    And use the database in the document directory and not the one in the main bundle.
    Only use the one in the main bundle as a payload file to be copied to the document directory if there is not file there.


    Why do you create a new string here:

    NSString *database2=[[NSBundle mainBundle]pathForResource:@"deptDatabase" ofType:@"sqlite"];
    NSString *databasePath2=[NSString stringWithFormat:@"%@",database2];
    

    The database2 is same as databasePath2. You are only using up memory here.

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

Sidebar

Related Questions

i have created a table named Ord in SQlite and the schema is :
I have a code: CREATE TABLE IF NOT EXISTS Person ( name varchar(24) ...
I have the following table: $sql = CREATE TABLE received_queries ( sender_screen_name varchar(50), text
I have a table named 'Attendance' which is used to record student attendance time
I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
I created a table named resources but when I insert values in it, this
I have two tables as following table one named tbooking having column fields as
I have created a Table Layout named table and I am trying to add
I've got the following JSON structure that defines a table and it's data. var
I have table (named tasks ) with column created_at that, basically, contains UNIX time-stamp.

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.