Parameterized query is not working as expected. When executing Informix ODBC command in c#:
OdbcCommand oc = Connection.CreateCommand();
oc.CommandText = "SELECT COUNT(*) AS CNT, MAX(someattr) AS attr1 FROM ?";
oc.Parameters.Add(new OdbcParameter() { Value = table.Name, OdbcType = OdbcType.Char });
try
{
OdbcDataReader or = oc.ExecuteReader(); //here the exception occurs
....
Exception occurs: ERROR [42000] [Informix][Informix ODBC Driver][Informix]A syntax error has occurred.
But the following code works without exception
OdbcCommand oc = Connection.CreateCommand();
oc.CommandText = String.Format("SELECT COUNT(*) AS CNT, MAX(someattr) AS attr1 FROM {0}", table.Name);
try
{
OdbcDataReader or = oc.ExecuteReader();
...
What might be the problem with parameterized query? :/