There are several problems:
1) You wrote to the wrong list. sqlite-dev is for those who develop
SQLite, sqlite-users is for those who develop using SQLite.
2) You didn't say what problem you have with that piece of code.
3) You didn't call sqlite3_step() after sqlite3_bind_text() to
actually execute your update statement.


Pavel

On Tue, Feb 22, 2011 at 6:43 AM, Ali Habib <[email protected]> wrote:
> Hi all,
> I want to update database that exists in the user iphone , I use the
> information in uitextview (animalDesciption ) to update using the following
>
> -(IBAction)UpadateData:(id)sender{
>
> sqlite3 *database;
>
> // Setup some globals
>
> NSString *databaseName = @"test.sql";
>
> // Get the path to the documents directory and append the databaseName
>
> NSArray *documentPaths =
> NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,
> YES);
>
> NSString *documentsDir = [documentPaths objectAtIndex:0];
>
> NSString * databasePath = [documentsDir
> stringByAppendingPathComponent:databaseName];
>
> [databasePath retain];
>
> sqlite3_stmt *compiledStatement;
>
> if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
>
> const char *sqlStatement = "Update animals set description = ?  WHERE name=
> ?";
>
> //sqlite3_prepare_v2(database, sqlStatement, 1,&compiledStatement, NULL) ;
>
> if(sqlite3_prepare_v2(database, sqlStatement , -1, &compiledStatement,
> NULL)== SQLITE_OK) {
>
> sqlite3_bind_text(compiledStatement, 1, [ self.animalDesciption.text
> UTF8String] , -1, SQLITE_TRANSIENT);
>
> sqlite3_bind_text(compiledStatement, 2, [ AnimalName UTF8String], -1,
> SQLITE_TRANSIENT);
>
> sqlite3_reset(compiledStatement);
>
> }
>
> sqlite3_finalize(compiledStatement);
>
> sqlite3_close(database);
>
> }
>
>
> }
>
> any suggestion, how to fix that please
>
> Best regards
>
> _______________________________________________
> sqlite-dev mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev
>
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to