I need to optimize a load application that runs through a database and writes to another database, but that has to be done through a Windows Forms application.
I am doing this using ArrayBindCount
of OracleCommand , but it is returning null reference error when passing the parameter, however I checked and the input vector when creating the parameter is normal and has no null object in the line that triggers the problem:
OracleConnection con = new OracleConnection(txtDestino.Text);
OracleCommand cmd = new OracleCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.BindByName = true;
cmd.ArrayBindCount = totalRegistros;
cmd.CommandText = @"insert into solicitacao (cd_codigo) values (:cdCodigo)";
List<int> array_CodSolicitacaoNovo = new List<int>();
array_CodSolicitacaoNovo.Add(12);
array_CodSolicitacaoNovo.Add(13);
array_CodSolicitacaoNovo.Add(14);
//ERRO NESTA LINHA ABAIXO
cmd.Parameters.Add(new OracleParameter("v_soli_cd_codigo", array_CodSolicitacaoNovo.ToArray());
//Executado apenas uma vez
con.Open();
cmd.ExecuteNonQuery();
con.Close();
If it has no null object, would the error be inside the new OracleParameter
method? I am using the Oracle.DataAccess 4.112.3.0 dll .
Note: I can not use Stored Procedures to do the inserts.