您好我想从表中的名称等于名称文本字段的表中选择一个密码,它给了我这个错误:“在 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;
}
}
}
}