Hi,
I am using the following code to store the datas into database
-(void)saveGimAccountListArray

NSArray*)GA1
{
for(int i = 0; i< [GA1 count];i++)
{
// NSString* a= [[NSString alloc]initWithData:[accountList objectAtIndex:i] encoding:NSASCIIStringEncoding];
NSLog(@"alias is %@",[(GIMAccount*)[GA1 objectAtIndex:i]alias]);
NSLog(@"id is %i",[(GIMAccount*)[GA1 objectAtIndex:i]ID]);
}
if(sqlite3_open([[self filepath] UTF8String], &db) == SQLITE_OK)
{
addStmt = nil;//check either it should be inside or outside once if problem comes
for (int i = 0; i < [GA1 count]; i++) {
if(addStmt == nil) {
const char *sql = "insert into GIMAccount(accAlias,bankId) Values(?, ?)";
if(sqlite3_prepare_v2(db, sql, -1, &addStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(db));
}
sqlite3_bind_text(addStmt, 1,[[(GIMAccount*)[GA1 objectAtIndex:i]alias]UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_int(addStmt, 2,[(GIMAccount*)[GA1 objectAtIndex:i]ID]);
if(SQLITE_DONE != sqlite3_step(addStmt))
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(db));
else
NSLog(@"sqlite last insert");
sqlite3_finalize(addStmt);
sqlite3_reset(addStmt);// crashing here for the last time for for loop telling "
library routine called out of sequence'"
}
}
}
Please can u tell me y it is crashing ? please ii am realy in trouble.