Hello Igor;

I have modified the code to avoid string writting problems now, it is:

int ActualizarBBDDAlumnos(char *dni, float nota)
{
    char *errorMsg;

    char *orden_SQL = sqlite3_mprintf("update ALUMNO set nota=%0.1f where 
dni=%Q;",nota,dni);
    sqlite3_exec(db,orden_SQL,0,0,&errorMsg);
    sqlite3_free(errorMsg);
    sqlite3_free(orden_SQL);
    return(0);    
}

after sqlite3_mprintf() function, I obtain the string like this: " update 
ALUMNO set nota=0.2 where dni='12345678J' "
After sqlite3_exec() errorMsg=NULL (0x00000000 Bad ptr), and the command is not 
exectuted in table ALUMNO, the value is not changed.
If I type exactly the same order from the sqlite3 command line, it works 
perfectly.

The database and tables where created folloeing the examples in 
http://www.sqlite.org/sqlite.html ,with CREATE TABLE commands and INSERT INTO 
TABLE commands.

I still don´t understand what is happening, so, as always, thank you very much.

Regards,

Alberto



----- Mensaje original ----
De: Igor Tandetnik <[EMAIL PROTECTED]>
Para: sqlite-users@sqlite.org
Enviado: miércoles, 15 de octubre, 2008 22:18:48
Asunto: Re: [sqlite] Error:"Expression cannot be evaluated" withsqlite3_exec()

Alberto Tellaeche <[EMAIL PROTECTED]>
wrote:
> Tank you very much for the response.
> the array is as expected, sprintf is woking fine. Also I get the same
> error if I write the SQL command directly in the sqlite3_exec()
> function, so this is not the error...

Show the CREATE TABLE statement for ALUMNO table. Show the exact text of 
the statement you run, after sprintf.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to