0
任何人都可以帮助我。如何使用WEB API或SERVER API的JSON &获取远程数据,然后存储到iPhone中的SQLite表中如何做到这一点。对于提取数据我想使用JSON。在SQLite数据库表是user_detailes其中有用户名&密码。并且服务器也有我想要获取相同的数据。 帮我看看这个。在iphone中提取数据和消除
给一些提示或链接,或样品来解决这个
任何人都可以帮助我。如何使用WEB API或SERVER API的JSON &获取远程数据,然后存储到iPhone中的SQLite表中如何做到这一点。对于提取数据我想使用JSON。在SQLite数据库表是user_detailes其中有用户名&密码。并且服务器也有我想要获取相同的数据。 帮我看看这个。在iphone中提取数据和消除
给一些提示或链接,或样品来解决这个
的NSString * txtUsername = @ “”;
NSString * txtPassword = @"";
sqlite3 *database;
NSString *sqlStatement = @"";
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
{
sqlStatement = [NSString stringWithString:@"select * from account_info "];
NSLog(@"%@",sqlStatement);
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, [sqlStatement cStringUsingEncoding:NSUTF8StringEncoding], -1, &compiledStatement, NULL) == SQLITE_OK)
{
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
txtUsername = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)] retain];
txtPassword = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)] retain];
}
}
sqlite3_finalize(compiledStatement);
sqlite3_close(database);
如果(txtUsername isEqulaToString:@ “USER1”]){ // 使用UIAlertView中这里 }
我没有得到你,我应该在哪里添加此。我有两个的UITextField用户和密码,点击按钮。无论是添加到登录操作还是添加到委托文件中。 – Harish 2011-04-01 09:05:17
它令我困惑 – Harish 2011-04-01 09:26:42
好吧如果我正确那么你想检查用户输入的用户名在文本字段中的用户名存储在数据库中,并显示一个confermation,如果两个mathced – saadnib 2011-04-01 10:52:30