WEB开发网
开发学院手机开发iPhone 开发 iPhone 编程 如何创建数据库并从中读取数据 阅读

iPhone 编程 如何创建数据库并从中读取数据

 2010-03-25 21:24:00 来源:WEB开发网   
核心提示:*)sqlite3_column_text(compiledStatement, 2)];NSString *aIconUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];// Create a
*)sqlite3_column_text(compiledStatement, 2)];

NSString *aIconUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];

// Create a new animal object with the data from the database

Person *person = [[Person alloc] initWithName:aName title:aTitle url:aIconUrl];

// Add the animal object to the animals Array

[personArr addObject:person];

[person release];

}

}

// Release the compiled statement from memory

sqlite3_finalize(compiledStatement);

}

sqlite3_close(database);

for (Person *tmpPerson in personArr) {

NSLog(@"You can see %@ %@'s icon at %@", tmpPerson.title, tmpPerson.name, tmpPerson.iconURL);

[tmpPerson release];

}

NSLog(@"Done.");

[personArr release];

[fileManager release];

[pool release];

return (0);

}

6. 编译执行

完成修改后,运行“Build > Build and Run”, 关掉弹出的iPhone Simulator窗口,选择"Run > Console" 打开控制台,可看到如下输出信息。

上一页  1 2 3 4 

Tags:iPhone 编程 如何

编辑录入:coldstar [复制链接] [打 印]
赞助商链接