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 11-30-2011, 06:19 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 37
ahsan123 is on a distinguished road
Default database access problem

Hello everyone

I am new to iphone database access. I am having database acess problem. Here is my code:
Code:
-(void)readFromDB
{
	NSString *path = [[NSBundle mainBundle]pathForResource:@"asldb" ofType:@"sqlite"];
	if(sqlite3_open([path UTF8String], &db) == SQLITE_OK){
		NSString *str = [NSString stringWithFormat:@"SELECT id,signimg,name FROM tbl1 WHERE catname=Amount"];
		NSLog(@"query=%@",str);

		const char *statement = [str UTF8String];
		sqlite3_stmt *compiled;
		if(sqlite3_prepare_v2(db, statement, -1, &compiled, NULL) == SQLITE_OK){
			while (sqlite3_step(compiled) == SQLITE_ROW) {
				NSUInteger recordID = sqlite3_column_int(compiled,0);
				NSLog(@"id=%d",recordID);
				NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiled,2)];
				NSLog(@"name:%@",aName);
               // NSData *imgData = [[NSData alloc]initWithBytes:sqlite3_column_blob(compiled,4) length:sqlite3_column_bytes(compiled,4)];
				//UIImage *img = [UIImage imageWithData:imgData];
				//[signImage setImage:img];
				//[imgData release];
				sqlite3_finalize(compiled);
				sqlite3_close(db);
				
			}
		}
	}
	
}
but my NSlog is not firing.
ahsan123 is offline   Reply With Quote
Reply

Bookmarks

Tags
database, iphone sdk, nslog

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: 405
16 members and 389 guests
AppsBlogger, chiataytuday, Clouds, David-T, dedeys78, Duncan C, e2applets, EvilElf, iekei, ipodphone, leostc, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,912
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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