0

您好我想从表中的名称等于名称文本字段的表中选择一个密码,它给了我这个错误:“在 UIView 类型的对象上找不到属性文本”?

NSString *queryUser = [NSString stringWithFormat:@"SELECT Password from Customer_tbl WHERE name=\"%@\"",txtEmail.text];

。H

   #import <UIKit/UIKit.h>
#import "/usr/include/sqlite3.h"


@interface LoginViewController : UIViewController

{
  NSString *databasePath;


  sqlite3 *customerDB;

}




@property (weak, nonatomic) IBOutlet UIView *txtEmail;
@property (weak, nonatomic) IBOutlet UIView *txtPassword;
@property (weak, nonatomic) IBOutlet UIButton  *btnLogin;
@property (weak, nonatomic) IBOutlet UILabel *lblStatus;
@property (weak, nonatomic) IBOutlet UITextView *txtView;


- (IBAction)backGroundTouched:(id)sender;
- (IBAction)textFieldReturn:(id)sender;

-(IBAction)findUser;

    //.m

#import "LoginViewController.h"

@implementation LoginViewController
@synthesize txtEmail;
@synthesize txtPassword;
@synthesize btnLogin;
@synthesize lblStatus;
@synthesize txtView;

-(void) findUser
{

  const char *dbPath = [databasePath UTF8String];
  sqlite3_stmt *statement;

  if(sqlite3_open(dbPath, &customerDB)== SQLITE_OK)
  {
    NSString *queryUser = [NSString stringWithFormat:@"SELECT Password from Customer_tbl WHERE name=\"%@\"",txtEmail];

    const char *query_stmt = [queryUser UTF8String];

    if (sqlite3_prepare_v2(customerDB, query_stmt, -1, &statement, NULL)== SQLITE_OK) {
      if (sqlite3_step(statement)== SQLITE_ROW) {
        NSString *name = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statement,0)];
        txtView.text = name;
      }
    }
  }


}
4

1 回答 1

0

你已经定义了

@property (weak, nonatomic) IBOutlet UIView *txtEmail;
@property (weak, nonatomic) IBOutlet UIView *txtPassword;

当我怀疑(根据您的描述)他们应该是

@property (weak, nonatomic) IBOutlet UITextField *txtEmail;
@property (weak, nonatomic) IBOutlet UITextField *txtPassword;
于 2012-11-25T17:12:42.127 回答