Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to retrieve only 3imagepaths or id from database in iphone
    primarykey
    data
    text
    <p>I am new to i phone programming.I am storing imagepath and audiopath in database.Now i want to retrieve imagepath form database i getting all imagepaths but i want to retrieve only 3 imagepaths remaining thing i want use in some other where. Can any body tell me how to retrieve only 3 imagepath form database Below code for retrieve imagepath from database</p> <pre><code> NSString *docsDir; NSArray *dirPaths; // Get the documents directory dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); docsDir = [dirPaths objectAtIndex:0]; arrayy=[[NSMutableArray alloc]init]; arrayy2=[[NSMutableArray alloc]init]; arrayy1=[[NSMutableArray alloc]init]; // array2=[[NSMutableArray alloc]init]; // Build the path to the database file databasePath = [docsDir stringByAppendingPathComponent: @"Taukydaataaa.db"]; // NSLog(@"%@",databasePath); NSFileManager *fn=[NSFileManager defaultManager]; NSError *error; BOOL success=[fn fileExistsAtPath:databasePath]; if(!success) { NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Taukydaataaa.db"]; success = [fn copyItemAtPath:defaultDBPath toPath:databasePath error:&amp;error]; } const char *dbpath = [databasePath UTF8String]; sqlite3_stmt *statement; if (sqlite3_open(dbpath, &amp;contactDB) == SQLITE_OK) { NSString *querySQL = [NSString stringWithFormat: @" select t.imagepath,t.audiopath,t.id from blauky b,taukyblauky tb,tauky t where tb.blaukyid=b.id and tb.taukyid=t.id and tb.blaukyid=1"]; const char *query_stmt = [querySQL UTF8String]; if (sqlite3_prepare_v2(contactDB, query_stmt, -1, &amp;statement, NULL) == SQLITE_OK) { while(sqlite3_step(statement) == SQLITE_ROW) { email_idField = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,2)]; email_idField1 = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,1)]; email_idField2 = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,0)]; // NSString *email_idField2 = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,2)]; NSLog(@"ASlma"); NSLog(@"%@",email_idField); NSLog(@"%@",email_idField1); NSLog(@"%@",email_idField2); [arrayy addObject:email_idField]; [arrayy1 addObject:email_idField1]; [arrayy2 addObject:email_idField2]; NSLog(@"%@",arrayy); NSLog(@"%@",arrayy1); NSLog(@"%@",arrayy2); NSLog(@"Iam here"); } } } } </code></pre> <p>Thanks Aslam</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload