如何显示数据从数据库中获取表视图在iphone
问题描述:
我有两个页面的是登录并显示page.when我点击登录页面提交按钮,然后在第二页是与数据的tableview显示从database.But让我从数据库中的数据,我需要在tableview中显示它。问题是在Xcode 表视图中显示的数据这是我在表视图中的.xib文件 的NSMutableArray * userArray = [ NSMutableArray数组];如何显示数据从数据库中获取表视图在iphone
int result = sqlite3_prepare_v2(itemdetails, sqlStatement, -1, &compiledStatement, NULL) ;
if(result == SQLITE_OK)
{
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
NSString *usernamedb = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
NSLog(@"dbvalue=%@",usernamedb);
NSLog(@"Count of rows:%d",count);
[itemcatg addObject:usernamedb];
}
}
sqlite3_finalize(compiledStatement);
接着给它的错误在登录页面中添加子视图提交按钮,如下面的代码行
[self presentModalViewController:subview animated:YES];
答
使用的SQLite的抽象,如下面将帮助: https://github.com/jameswomack/CCData
这组类允许您轻松地将SQLite数据导入NSArray等本机对象,因此您可以这样做:
cell.text = [arrayFromDatabase objectAtIndex:indexPath.row];
的问题不明确。 – rakeshNS 2012-01-28 09:30:35
@rani - 你可能要接受一些问题的答案。你可能会得到更多的帮助。 – Rayfleck 2012-01-28 23:17:18