我的下一个视图有四个字段,我想在表格上选择名称时显示所有详细信息。
创建数据库的代码如下:
-(IBAction) saveData
{
sqlite3_stmt *statement;
const char *dbpath = [databasePath UTF8String];
if (sqlite3_open(dbpath, &Information) == SQLITE_OK)
{
NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO CONTACTS (name,address, phone,imageUrl) VALUES (\"%@\", \"%@\", \"%@\",\"%@\")", name.text,address.text,phone.text,imageUrl.text];
const char *insert_stmt = [insertSQL UTF8String];
sqlite3_prepare_v2(Information, insert_stmt, -1, &statement, NULL);
if (sqlite3_step(statement) == SQLITE_DONE)
{
status.text = @"Contact added";
name.text = @"";
address.text = @"";
phone.text = @""; i
imageUrl.text=@"";
} else
{
status.text = @"Failed to add contact";
}
sqlite3_finalize(statement);
sqlite3_close(Information);
}
}
我是 ios 开发的新手,所以请建议如何在我的详细视图中显示数据,如上所述。谢谢