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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:21:30+00:00 2026-05-30T01:21:30+00:00

I want to insert the data in a SQLite table login when a button

  • 0

I want to insert the data in a SQLite table login when a button is clicked, the problem is that when I click on the register button data is getting stored in variable but not in database table, and When I try to statically pass the value the data will be insert but When i trying to dynamically store data then not work.

Here is my code. Please go through it and help to solve this issue.

NSString *path; 

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask ,YES);

path = [paths objectAtIndex:0];

dbName = [[NSString alloc] initWithString:[path stringByAppendingPathComponent:@"mnc.sqlite"]];

NSFileManager *fileMgr = [NSFileManager defaultManager];

if([fileMgr fileExistsAtPath:dbName]== NO)
{
  const char *dbPath = [dbName UTF8String];

  if (sqlite3_open(dbPath,&connectionDB)==SQLITE_OK) 
  {
    char *errMsg;
    const char *sql_stmt = " create table if not exists login(user_name text ,password text)";

    if (sqlite3_exec(connectionDB,sql_stmt,NULL,NULL,&errMsg))
    {
      printf("\n fail to create table ");
    }

    sqlite3_close(connectionDB);
  }
  else 
  {
    NSLog(@"fail to open create database");
  }
}

[fileMgr release];

if(sqlite3_prepare_v2(connectionDB, query ,-1, &statment,NULL) == SQLITE_OK)
{
  sqlite3_bind_text(statment,1,"cc", -1,SQLITE_TRANSIENT);
  sqlite3_bind_text(statment,2,"sa",-1,SQLITE_TRANSIENT);
  NSLog(@"aadd");
}

if (sqlite3_step(statment)== SQLITE_DONE)
{
  NSLog(@"This should be real error checking!");
  sqlite3_finalize(statment);
}  
  • 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-30T01:21:32+00:00Added an answer on May 30, 2026 at 1:21 am

    It is quite complex to work with sqlite, thats why I use fmdb this will simplify the work.

    This is an Objective-c wrapper around SQLite

    Hope this helps.

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

Sidebar

Related Questions

I want to insert some data to mydatabase.sqlite but I have a problem. There
I want to insert data into a table where I don't know the next
I want to be able to insert data from a table with an identity
I want to insert data into a table, then if the table already has
From my iPhone app I insert some data in my sqlite database that include
all. I want to insert some initial data in db(sqlite) when it was created.
I want to insert some data into a table and I want the multiple
I want to create a service which will insert provided data into spreadsheet fields
I have to insert a string into a sqlite data base my command ..
I made iPad application in which, I want to insert record into database table,

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.