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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:17:39+00:00 2026-05-22T16:17:39+00:00

hii every one i am using following method to insert data into data base

  • 0

hii every one

i am using following method to insert data into data base , but it will save the first entered value only all the time
the following method is in the insertUpdateDelete class

- (void) InsertRecord {


    if(addStmt == nil) {

        NSString *nsql = [NSString stringWithFormat:@"insert into tbl_Users(FirstName,MiddleName) Values('%@','%@')",strFirstName,strMiddleName];
        const char *sql = [nsql UTF8String];



        if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK)
        {
            NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database));

        }
    }



    if(SQLITE_DONE != sqlite3_step(addStmt))
        NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
    else
        //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid
        intID = sqlite3_last_insert_rowid(database);

    //Reset the add statement.
    sqlite3_reset(addStmt);
}

through following code i am calling this method, tfText[0] & tfText[1] are text field variable , problem is,, on every click of save after entering some data in text field, it will save only the first entered value into the data base

 - (void) save_Clicked
    {


        iICS_testAppDelegate *appDelegate = (iICS_testAppDelegate *)[[UIApplication sharedApplication] delegate];

        //Create a Items Object.
        insertUpdateDelete *objInsertUpdateDelete = [[insertUpdateDelete alloc] init];

        objInsertUpdateDelete.strFirstName = tfText[0].text;
        objInsertUpdateDelete.strMiddleName = tfText[1].text;

        [appDelegate InsertRecord:objInsertUpdateDelete];

    }

can any one help me,,,,thanx 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-05-22T16:17:39+00:00Added an answer on May 22, 2026 at 4:17 pm
    const char *addRecord = "insert into Test(taskname, desc) values(?, ?)";
    sqlite3_stmt *statement;
    
    if(sqlite3_prepare_v2(database, addRecord, -1, &statement, NULL) != SQLITE_OK)
    {
        NSLog(@"Error while Inserting Record :- '%s'", sqlite3_errmsg(database));
        sqlite3_finalize(statement);
        return -1;
    }
    
    sqlite3_bind_text(statement, 1, [Ttitle UTF8String], -1, SQLITE_TRANSIENT);
    
    sqlite3_bind_text(statement, 3, [Tdesc UTF8String], -1, SQLITE_TRANSIENT);
    
    if(SQLITE_DONE != sqlite3_step(statement))
    {
        NSLog(@"Error1 while Inserting Record :- '%s'", sqlite3_errmsg(database));
        sqlite3_finalize(statement);
        return -1;
    }
    else 
    {
        NSLog(@"Record Inserted Successfully.");
        sqlite3_finalize(statement);
        return sqlite3_last_insert_rowid(database);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hii every one i am using following code to loading data stored in data
hii every one, following is my code which displays 4 panel one is at
hii every one i have created a data entry screen like this in which
hii every one I need to add one column to my existing table so
hii every one i am brand new to obj c, i have did a
hii every one can i use a navigation based template to create project in
hii every one i am new to iphone , can any one tell me
Hi I'm trying to build a layout where some shapes will popup every 2
hi i'm using log4net for logging my website. Every day a new file is
I am reading one line at a time from a file, but at the

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.