public static void SetParameterValue(IDbCommand command, string paramName, object inValue)
{
try
{
var currentParam = (IDbDataParameter)command.Parameters[paramName];
if (currentParam != null)
{
currentParam.Value = inValue;
}
else
{
throw new Exception("Parameter: " + paramName + " is missing from stored procedure: " + command.CommandText);
}
}
catch (Exception ex)
{
throw new Exception("Parameter: " + paramName + " is missing from stored procedure: " + command.CommandText, ex);
}
}