我有一个数组,即 _twoArray 它包含如下数据
ha ha 2d array(
(
"Anand Kapadiya",
"Alok Darji",
"Akash Parikh",
"Ajay Desai",
"Aysu Can",
"Ayegba James",
"Ashish Modi",
"Arks Patel",
"Archit Patel",
"Anzey Khodorovskyy"
),
(
"12/01",
"08/13/1990",
"12/09/1989",
"05/22/1988",
"04/14/1992",
"12/15/1905",
"09/08",
"05/27/1990",
"05/22/1990",
"02/06"
)
)
我有一个包含一个表和 2 个字段的数据库,一个是名称,另一个是出生日期如何从这个二维数组在数据库中添加出生日期和名称我正在尝试以下代码
for (id obj in _twoArray)
{
sqlite3_stmt *stmt;
int x;
char *update = "insert into PersonNamesAndBirthDates (Names,Birthdates) values(? ?);";
x = sqlite3_prepare_v2(database1, update, -1, &stmt, nil);
if (x == SQLITE_OK)
{
NSLog(@"PersonNamesAndBirthDates is -->%@",[NSString stringWithFormat:@"%@",obj]);
sqlite3_bind_text(stmt, 1, [[NSString stringWithFormat:@"%@",obj] UTF8String],-1, NULL);
sqlite3_bind_text(stmt, 2, NULL,-1, NULL);
}
if (sqlite3_step(stmt) != SQLITE_DONE){}
NSLog(@"Error: ");
sqlite3_finalize(stmt);
}
请给我一些建议,或者如果这不可能,那么告诉我如何同时在表中添加 2 个不同的数组