Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-09-2011, 08:41 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 1
izon90 is on a distinguished road
Default can't get results from executequery using FMDB

I created the db with firefox addon sqlite manager. db can be opened. and the query is working in sqlite manager. but i just can't get the results from FMResultSet.

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    // Add the navigation controller's view to the window and display.
    NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [array objectAtIndex:0];
    NSString *pathString = [path stringByAppendingPathComponent:@"todo.sqlite"];
    FMDatabase *db = [FMDatabase databaseWithPath:pathString];
    if (![db open]) {
        NSLog(@"cannot connect to database");
    } else
    {
        NSLog(@"successfully!");
    }
    [db open];
    FMResultSet *s = [db executeQuery:@"SELECT * FROM todo"];
    if (!s) {
        NSLog(@"no result set fechted");
    }
	while ([s next]) {
		NSLog(@"%@", [s stringForColumn:@"title"]);
	}    
    [db close];
    
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}
izon90 is offline   Reply With Quote
Reply

Bookmarks

Tags
database, fmdb, iphone, sdk, sqlite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 401
18 members and 383 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, jarv, LunarMoon, morterbaher, n00b, pbart, Pudding, QuantumDoja, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:22 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0