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 03-22-2010, 01:33 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 4
yohliying is on a distinguished road
Default sqlite3 update text in uitextview

had the sqlite statement ready for update..but i am confuse about getting text from uitextview and updating it..and i waned to update it using a uibutton..how do i carry on after creating the sql statement???kinda lost..any new solution is appreciated..


Code:
- (void) saveAllData {

if(isDirty) {

    if(updateStmt == nil) {
        const char *sql = "update Snap Set snapTitle = ?, snapDesc = ?, Where snapID = ?";
        if(sqlite3_prepare_v2(database, sql, -1, &updateStmt, NULL) != SQLITE_OK)
            NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database));
    }

    sqlite3_bind_text(updateStmt, 1, [snapTitle UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(updateStmt, 2, [snapDescription UTF8String], -2, SQLITE_TRANSIENT);
    sqlite3_bind_int(updateStmt, 3, snapID);
        if(SQLITE_DONE != sqlite3_step(updateStmt))
        NSAssert1(0, @"Error while updating. '%s'", sqlite3_errmsg(database));

    sqlite3_reset(updateStmt);

    isDirty = NO;
}

//Reclaim all memory here.
[snapTitle release];
snapTitle = nil;
[snapDescription release];
snapDescription = nil;

//isDetailViewHydrated = NO;
}
yohliying is offline   Reply With Quote
Old 03-22-2010, 02:09 AM   #2 (permalink)
iPhone app Developer
 
Join Date: Jul 2009
Location: India
Age: 26
Posts: 36
brian is on a distinguished road
Send a message via Yahoo to brian Send a message via Skype™ to brian
Default

Where have u assigned the text from textview. Is snapTitle and snapDesc textviews?

If so, then you have to use "snapTitle.text" instead of "snapTitle".
brian is offline   Reply With Quote
Old 03-22-2010, 02:52 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 4
yohliying is on a distinguished road
Default

Quote:
Originally Posted by brian View Post
Where have u assigned the text from textview. Is snapTitle and snapDesc textviews?

If so, then you have to use "snapTitle.text" instead of "snapTitle".
erm..snapDesc..so how do i go about doing it?

by writing
Code:
- (IBAction) save_Clicked:(id)sender {

	snap2playObj.snapDescription = self.viewDesc.text;
	//dismiss controller
	[self.navigationController dismissModalViewControllerAnimated:YES];
	
	[self.navigationController popViewControllerAnimated:YES];
}
i can "update" the text in textview but it aint storing anything into the database..because the method saveAllData wasnt being called at all..how do i call the method to update?argh

Last edited by yohliying; 03-22-2010 at 03:45 AM.
yohliying is offline   Reply With Quote
Old 03-22-2010, 10:08 PM   #4 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 4
yohliying is on a distinguished road
Default

anyone help?
yohliying is offline   Reply With Quote
Old 03-23-2010, 12:02 AM   #5 (permalink)
iPhone app Developer
 
Join Date: Jul 2009
Location: India
Age: 26
Posts: 36
brian is on a distinguished road
Send a message via Yahoo to brian Send a message via Skype™ to brian
Default

Quote:
i can "update" the text in textview but it aint storing anything into the database..because the method saveAllData wasnt being called at all..how do i call the method to update?argh
YOu have to call the method, where it has to be called.

if the method is in same class, you can call it by

Code:
[self saveAllData];
brian is offline   Reply With Quote
Old 03-23-2010, 09:46 PM   #6 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 4
yohliying is on a distinguished road
Default

if the method is in another file?
yohliying is offline   Reply With Quote
Old 03-27-2010, 08:28 AM   #7 (permalink)
iPhone app Developer
 
Join Date: Jul 2009
Location: India
Age: 26
Posts: 36
brian is on a distinguished road
Send a message via Yahoo to brian Send a message via Skype™ to brian
Default

Quote:
Originally Posted by yohliying View Post
if the method is in another file?

You should call the function by creating an instance of the class which holds the function.
brian is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, sqlite3, uitextview

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: 351
11 members and 340 guests
akacaj, c2matrix, cgokey, esoteric, givensur, HemiMG, Mirotion22, mjnafjke, Pudding, SLIC, Techgirl-52
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,651
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Mirotion22
Powered by vBadvanced CMPS v3.1.0

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