I have a small problem with my application. The INSERT routine gives me its error:
ORA-01036: illegal variable name / number
Remembering that the bank is Oracle and the application in C #. Here is the code that generates the error:
public void SalvarCampos(ModelCampos model)
{
connectionBanco.ConectarBanco(modelLogin);
String query = "INSERT INTO CARTEIRA_CREDITO (ANOMES, ANOMESBASE1, ANOMESBASE2, ANOMESBASE3, COD_COOP, ATIVO, CENTRALIZACAO, VLR_SUBTOTAL, VLR_CARTEIRACREDITO) " +
"VALUES (iANOMES, iANOMESBASE1, iANOMESBASE2, iANOMESBASE3, iCOD_COOP, iATIVO, iCENTRALIZACAO, iVLR_SUBTOTAL, iVLR_CARTEIRACREDITO)";
OracleCommand command = new OracleCommand(query, connectionRateio.connection);
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("iANOMES", Convert.ToInt32(model.anoMes));
command.Parameters.AddWithValue("iANOMESBASE1", Convert.ToInt32(model.anoMesBase1));
command.Parameters.AddWithValue("iANOMESBASE2",Convert.ToInt32(model.anoMesBase2));
command.Parameters.AddWithValue("iANOMESBASE3", Convert.ToInt32(model.anoMesBase3));
command.Parameters.AddWithValue("iCODCOOP", model.codCoop);
command.Parameters.AddWithValue("iATIVO", model.ativo);
command.Parameters.AddWithValue("iCENTRALIZACAO", model.centralizacao);
command.Parameters.AddWithValue("iVLRSUBTOTAL", model.vlrSubTotal);
command.Parameters.AddWithValue("iVLRCARTEIRACREDITO", model.vlrCarteiraCredito);
try
{
command.ExecuteNonQuery();// <-- ERRO DISPARADO NESSA LINHA!
command.Transaction.Commit();
connectionRateio.FecharConexaoBanco();
}
catch (Exception exc)
{
//Erro
}
connectionBanco.FecharConexaoBanco();
}
Follow the field types in the application:
- ANOMES, ANOMESBASE1, ANOMESBASE2, ANOMESBASE3, COD_COOP: NUMBER
- ACTIVE, CENTRALIZATION, VLR_SUBTOTAL, VLR_CARTEIRACREDITO: NUMBER (15,2)
Does anyone know the reason for this error?