Hello colleagues;

I am new to sqlite, and I have recently started to use it from the command line 
(sqlite3.exe) and in C programs.

In my C example program I open de database at the beginning and close it 
beforte the end of the program.
 Examples like:

    memset(orden_SQL, 0, 200*sizeof(char));
    sprintf(orden_SQL,"select nBlancos from CORRECCION_EXAMEN where 
modelo='%c';",modelo);
    sqlite3_get_table(db,orden_SQL,&Resultado,&Rows,&Cols,&errorMsg);
    for(i=1;i<=Rows;i++)
    {
        examen.blancos[i-1]=atoi(Resultado[i]);
    }

work perfectly well, but I am having a very annoying problem with 
sqlite3_exec() function. The code just after the example above is:

    memset(orden_SQL,0,200*sizeof(char));
    sprintf(orden_SQL,"update ALUMNO set nota=%0.1f where dni='%s';",nota,dni);
    res=sqlite3_exec(db,orden_SQL,0,0,&errorMsg);
    sqlite3_free(errorMsg);


and it does not work. "res" value is 0 and "errorMsg" is Error:"Expression 
cannot be evaluated".

I have also tried to substitute sqlite3_exec with sqlite3_prepare() + 
sqlite3_step() with the same result.
The command "update ALUMNO set nota=9 where dni='12345678P';" works perfect in 
the comand line.

What problem I am having here? It is very important for me for the project I am 
developping, so I would appreciate a lot any kind of advise.

Best regards,

Alberto



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

Reply via email to