dimanche 7 juillet 2019

how to fecth all the record from table using fopen

char sqlfmt[1024];
snprintf(sqlfmt, sizeof(sqlfmt), "SELECT id from emp");
std::string sql(sqlfmt);
FILE*  fp  = connection(sql);
n  = fscanf(fp, "%d", &id);
fclose(fp);

Emp table has id,name column.How to fetch the recordsin single query and store in some other variable.

Aucun commentaire:

Enregistrer un commentaire