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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:48:29+00:00 2026-05-24T06:48:29+00:00

I was trying to develop a login program that would work with a database.

  • 0

I was trying to develop a login program that would work with a database. I used a table emplopyee, with columns “Userid” , “Passwd” and “Name” (All the three are of type ‘VARCHAR’). In my program I have added two textfields “username” and “password”. I got the “username” and “password” values and stored them in two global objects(of type ‘NSString’).
Now I would like to select the “Name” that matches with the given “Userid” and “Passwd”.
The coding part which I used for the above reason is here:

sqlite3 *dB;
sqlite3_stmt *compiledStatement;
if(sqlite3_open([databasePath UTF8String], &dB)==SQLITE_OK){
    const char *sql="Select Name from employee Where Userid=? , Passwd=?";

           if(sqlite3_prepare_v2(dB, sql, -1, &compiledStatement, NULL)!=SQLITE_OK)
    NSAssert1(0,@"Error while reading Employee Name -->%s',sqlite3_errmsg(dB));
}
sqlite3_bind_text(compiledStatement,1,[txt UTF8String],-1,SQLITE_TRANSIENT);
   /*txt and txt1 are the global objects i told about they have the values of Userid  and Passwd from the texxt fields respectively*/
sqlite3_bind_text(compiledStatement,2,[txt1 UTF8String],-1,SQLITE_TRANSIENT);


if(SQLITE_DONE != sqlite3_step(compiledStatement))
 txt3 =[[NSString alloc] initWithUTF8String:(char*)sqlite3_column_text(compiledStatement,0)];


else
    NSAssert1(0, @"Error while getting the username '%s'", sqlite3_errmsg(dB));         
    sqlite3_reset(compiledStatement);

Its error free while compiling but the application does not work, it says some error in the query (on run time).
if you can’t figure out with the data given I’ll provide you the whole code.

I have added the error details here:
this error occurs if i use ” , ” (comma) in the select query:

*** Terminating app due to uncaught exception
‘NSInternalInconsistencyException’, reason: ‘Error while reading Employee Name –> ‘near “,”: syntax error’ ‘

and this one occurs when I use “AND” in the select query:

*** Terminating app due to uncaught exception
‘NSInternalInconsistencyException’, reason: ‘Error while getting the username ‘not an error”

  • 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-24T06:48:30+00:00Added an answer on May 24, 2026 at 6:48 am

    First issue:

    In an SQL WHERE clause, if you have criteria that all need to be true you use AND, not a comma, to combine them:

    SELECT Name FROM employee WHERE Userid=? AND Passwd=?
    

    If that’s not it, suggest you edit your run-time error message details in to your question.

    For reference, see SQL As Understood By SQLite.

    Second issue:

    It looks like you’re incorrectly only treating return code SQLITE_DONE from function sqlite3_step() as ‘success’ – the message ‘not an error’ is the clue. Perhaps the value returned might be SQLITE_ROW – indicating the query succeeded, and that you have some data to read?

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

Sidebar

Related Questions

I'm trying to develop a new program. The work flow looks like this: Login
I'm trying to develop a module for Joomla 1.5 that identifies brute force login
I'm trying to get some ideas about how to develop a web login screen.
I'm trying to develop some SharePoint workflows for the company I work for, and
I am trying to develop my login script to give feedback to the user
Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in
I am trying to develop a database model for a recruitment website and I
I am a newbie trying to develop some login panel. The problem now is
I am looking to develop an app that will take login details from the
I am trying to develop a tool that inserts comments in C/C++ source files

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.