Need to update database by new value (Name and Address) provided by the user.The error in query is that:
error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive] sqlite3_bind_text(res, 2, *c2)
- error: too few arguments to function ‘int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int, void ()(void))’ sqlite3_bind_text(res, 2, *c2)
my code is:
const char *c1 = updatedName.c_str();
const char *c2 = updatedAdd.c_str();
char *sql = ("UPDATE RECORDS SET NAME = ? AND ADDRESS = ? WHERE ACCOUNT_No = ?");
rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
sqlite3_bind_text(res, 1, *c1);
sqlite3_bind_text(res, 2, *c2);
sqlite3_bind_int(res, 3, acc);
rc = sqlite3_step(res);
sqlite3_finalize(res);
sqlite3_bind_texttakes 5 arguments but you only provide 3, so 2 arguments are missing. - Weather Vane*c1and*c2are of typeconst charand the function ask forconst char*. - Roy Avidan