vendredi 13 mars 2015

Use a variable into a sql statement - c interface

I am new to SQLite but I need it in my c program to analyse tables.

If I use as sql statement:



char *sql;
sql = "SELECT * FROM table;";


it perfectly works. But I would like to have



sql = "SELECT X FROM table;";


where X is a variable to which I assign a different column name each time.

I have tried with



sql = "SELECT 'X' FROM table;";


but it does not work. Looking on the web, it is not clear to me if it is possible to use a variable to select columns and if I should pay attention to it. Any advice on how to proceed is welcome


Aucun commentaire:

Enregistrer un commentaire