Using C# 3.5, accessing SQL Server to execute a stored procedure with a number of parameters of various data types (int, money(decimal), datetime, string). Some of these parameters can have null values. When I execute the stored procedure using the query analyzer, the proc works OK. When I execute the stored procedurefrom within my c# program using ASO.NET I get back an error message the a parameter was not supplied. It is always the first parameter with the null value. If I give that parameter a value,I get a messagenot about that parameter but about the next one which is now the first with a null value
Following is a code snippet used to create an SqlParameter:
public static SqlParameter MakeInputParam(string ParamName, decimal? Value)
{
SqlParameter param = new SqlParameter(ParamName, SqlDbType.Decimal);
param.Direction =
ParameterDirection.Input;
param.IsNullable =
true;
if (Value == null)
{param.Value =
null; }
else
{param.Value = (
decimal)Value;}
return param;
}
Developer