I'm curious if there is a difference, if any between adding Parameters to the OracleCommand and then adding them to the OracleDataAdapter or by directly adding them to the OracleDataAdapter?
For example,
Adding them to the OracleCommand and then linking them to the OracleDataAdpater
string f= "foo";
string sql = "SELECT @c FROM Dual";
using(OracleCommand command = new OracleCommand(sql, this.Connection))
{
OracleParameter param = new OracleParameter("@c", f);
command.Parameters.Add(param);
OracleDataAdapter adapter = new OracleDataAdapter(command);
adapter.SelectCommand = command;
DataSet dataset = new DataSet();
adapter.Fill(dataset);
return dataset;
}
Adding them directly to the OracleDataAdapter
string f= "foo";
string sql = "SELECT @c CalcVarValue FROM Dual";
using(OracleCommand command = new OracleCommand(sql, this.Connection))
{
OracleDataAdapter adapter = new OracleDataAdapter(command);
adapter.SelectCommand.Parameters.Add(new OracleParameter("@c", f));
DataSet dataset = new DataSet();
adapter.Fill(dataset);
return dataset;
}
Is one way more preferred over the other? Is adding to the OracleDataAdapter directly faster in execution compared to the other method?