I have that code :
string query = "select count(*)
from MODEL m
join KOLEKCJA ko on m.SEZON = ko.sezon
left join PRODUCENCI p on p.PRODUCENT_ID = m.PRODUCENT_ID
left join KRAJ k on k.KOD = m.KRAJ_POCH
where ko.SEZON like :ko.SEZON
and m.DO_PRODUKCJI like :m.DO_PRODUKCJI
and k.KOD like :KOD
and p.PRODUCENT_ID like :PRODUCENT_ID
and m.MODEL_ID like :MODEL_ID";
OdbcCommand comm = new OdbcCommand();
comm.Connection = con;
comm.CommandText = query;
comm.CommandType = CommandType.Text;
comm.Parameters.AddWithValue("ko.SEZON", sezon);
comm.Parameters.AddWithValue("m.DO_PRODUKCJI", do_produkcji);
comm.Parameters.AddWithValue("KOD", kraj);
comm.Parameters.AddWithValue("PRODUCENT_ID", fabryka);
comm.Parameters.AddWithValue("MODEL_ID", model);
result = (int)comm.ExecuteScalar();
and always have error that parameters are not changed ;/
What do I wrong ?
ODBC connections do not work with named placeholders like the other connection types do. ODBC uses positional parameters marked by a question mark (?). Replace your bind variables with question marks and be sure to add your parameters in the correct order. The parameter name you pass to AddWithValue() can be anything. Like so: