Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Login 如何比较Sqlite3表中的两行?_Login_Sqlite_Ios7.1 - Fatal编程技术网

Login 如何比较Sqlite3表中的两行?

Login 如何比较Sqlite3表中的两行?,login,sqlite,ios7.1,Login,Sqlite,Ios7.1,这里我试图比较组成表中行值的详细信息 ][1] 这里还有我的代码 `- (IBAction)LogIn:(id)sender { sqlite3 *dbConnection; const char *dbpath = [[sharedobj getSandboxPath] UTF8String]; sqlite3_stmt *statement; if (sqlite3_open(dbpath, &d

这里我试图比较组成表中行值的详细信息 ][1] 这里还有我的代码

`-

     (IBAction)LogIn:(id)sender {

        sqlite3 *dbConnection;
        const char *dbpath = [[sharedobj getSandboxPath] UTF8String];
        sqlite3_stmt    *statement;


        if (sqlite3_open(dbpath, &dbConnection) == SQLITE_OK)
        {
            NSString *querySQL = @"SELECT USERNAME, PASSWORD FROM NEWVALUES";


            const char *query_stmt = [querySQL UTF8String];

            if (sqlite3_prepare_v2(dbConnection,
                                   query_stmt, -1, &statement, NULL) == SQLITE_OK)
            {
                if (sqlite3_step(statement) == SQLITE_ROW)
                {
                     NSString *emailId = [[NSString alloc]
                                initWithUTF8String:
                                (const char *) sqlite3_column_text(statement,0)];
                    NSString *password  = [[NSString alloc]
                                initWithUTF8String:(const char *)
                                sqlite3_column_text(statement, 1)];

                    if ([emailId isEqualToString:self.userNameField.text] || [password isEqualToString:self.passwordField.text]) {
                        NSLog(@"Login Credentials Correct");
                        CHECKViewController *checkobj=[self.storyboard instantiateViewControllerWithIdentifier:@"CHECK"];
                        [self.navigationController pushViewController:checkobj animated:YES];

                    }
                    else{

                           UIAlertView *alert = [[UIAlertView alloc]
                                              initWithTitle:@"Error"
                                              message:@"Login Credentials are Incorrect"
                                              delegate:nil
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"OK ", nil];
                        [alert show];
                    }
                    }
                    NSLog(@"Login Details %@ %@",self.userNameField.text ,self.passwordField.text );
                }
                sqlite3_finalize(statement);


            }
            else{
                NSLog(@"SQLITE NOT OK");
                NSLog(@"Error %s ", sqlite3_errmsg(dbConnection));
            }
            sqlite3_close(dbConnection);
       }
imgur.com/QW6KX.png

当输入第一行值时,它工作,但当我输入第二行值时,它不进行比较。我在这里做错了什么? 请给出解决此问题的建议。
提前谢谢

此代码多久调用一次
sqlite3\u step()