This won't work:
public List<DivisionStatus> GetDivisionsByCds(int? reportId, string connectionString)
{
var sqlParameter = new SqlParameter()
{
SqlDbType = SqlDbType.Int,
ParameterName = "@CFTCReportID",
Value = reportId
};
This will:
public List<DivisionStatus> GetDivisionsByCds(int? reportId, string connectionString)
{
var sqlParameter = new SqlParameter()
{
SqlDbType = SqlDbType.Int,
ParameterName = "@CFTCReportID"
};
if (reportId == null)
{
sqlParameter.Value = DBNull.Value;
}
else
{
sqlParameter.Value = reportId;
}
This could kinda be a sister blog posting to this.
No comments:
Post a Comment