I'm using DbCommand
from : System.ComponentModel.Component
I'm building an object with params :
DbCommand command = _webERPDB.GetStoredProcCommand("mySp");
_webERPDB.AddInParameter(command, "@a", DbType.Int32, policyId);
_webERPDB.AddInParameter(command, "@b", DbType.Int32, appPolicyPrintQaCheckListId);
_webERPDB.AddInParameter(command, "@c", DbType.Int32, createdBy);
And now, I want to iterate it using linq:
IEnumerable<DbParameter> t = from a in command.Parameters select a;
but it's generating following error :
You have to use
Cast<T>()
because the type ofParameters
isDbParameterCollection
, which implementsIEnumerable
(non-generic) but notIEnumerable<T>
. You can write