Vera
Vera

Reputation: 27

Compiler warning ..C language (type issue..)

I get this warning:

499: warning: conversion lacks type at end of format

line 499 is:

char query [512];
    sprintf(query, "SELECT IFNULL(SUM(Netto_Acquisto),0) AS 'Totale acquisti mese' from Acquisti WHERE mid(Data_Acquisto,6,2)='%'",mese);

mese is declared as : char mese[3]; Netto_Acquisto is char[9];--> in mysql is decimal(9.2) Data_Acquisto is char[10];--> in mysql is date

Sorry to bother you...Thanks a lot

Upvotes: 0

Views: 1433

Answers (3)

anurag-jain
anurag-jain

Reputation: 1410

sprintf(query, "SELECT IFNULL(SUM(%s),0) AS \'Totale acquisti mese\' from Acquisti WHERE mid(%s,6,2)=%s",Netto_Acquisto,mese,Data_Acquisto); you forgot to mention the escape sequences and format specifiers.

Upvotes: 0

Gouse Shaik
Gouse Shaik

Reputation: 338

Here you missed the format specifier as you have written it like this % in the code. Just look after it you'll get the answer.

Upvotes: 1

K-ballo
K-ballo

Reputation: 81349

You don't seem to be specifying the actual type of the argument at %, if mese its a string it should be %s.

Upvotes: 4

Related Questions