I have a parameter in my oracle function that i want to pass null to it,
what i did is:
cmd.Parameters.AddWithValue("al_acc_br", DBNull.Value);
however, i am getting error that the number of parameters or the type is not correct
and as you know we can't see the actual query from .net library
the number is absolutely correct, but in my way to debug the issue i would like to ask you if i am passing the null correctly
thanks
Update
some code
using (OracleConnection cn = new OracleConnection(OracleConnString(oracleHost, oraclePort, oracleServiceName, oracleUsername, oraclePassword)))
{
OracleDataAdapter oda = new OracleDataAdapter();
OracleCommand cmd = new OracleCommand();
cmd.Connection = cn;
cmd.CommandText = oracleSchema + "." + oracleFunction;
cmd.CommandType = CommandType.StoredProcedure;
fillParameters(cmd);
oda.SelectCommand = cmd;
i know that i am using a deprecated library but it is fine for us
Update 2
the parameter in my oracle function has these types:
Varchar(8), Varchar(40), Numeric(4), Numeric(6), Varchar(35), Numeric(3), Date, Numeric(20,6), Datetime
and what i do is:
for all varchar(x)
i insert them from c# as string
for all numeric(x)
i insert them from c# as integer
for all numeric(x,y)
i insert them from c# as double
for all Date
and Datetime
i insert them like this:
cmd.Parameters.AddWithValue("as_date_time", DateTime.Now.ToString("dd/MMM/yyyy"));//'18/MAY/2015'
am i wrong please?