Uniqueminds

Full Version: select data from database(iphone)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
-(IBAction)display
{

NSMutableArray *array=[[NSMutableArray alloc]init];

NSString *dbpath=[self getdbpath];

if(sqlite3_open([dbpath UTF8String], &database)==SQLITE_OK)
{

NSString *eid=select1.text;


NSString *nsatt=[NSString stringWithFormatAngry"select * from
Details where name = '%@'",eid];

const char *stmch=[nsatt UTF8String];

if(sqlite3_prepare_v2(database, stmch, -1, &stmnt1,
NULL)==SQLITE_OK)
{

while (sqlite3_step(stmnt1)==SQLITE_ROW)
{
// [array removeAllObjects];

[array addObject:[NSString stringWithUTF8StringSadchar
*)sqlite3_column_text(stmnt1, 0)]];

[array addObject:[NSString stringWithUTF8StringSadchar
*)sqlite3_column_text(stmnt1, 1)]];

[array addObject:[NSString stringWithUTF8StringSadchar
*)sqlite3_column_text(stmnt1, 2)]];

name.text=[array objectAtIndex:0];

adress.text=[array objectAtIndex:1];

rollno.text=[array objectAtIndex:2];

NSLog(@"name %@",array);
}
}
sqlite3_finalize(stmnt1);

}


}