In my Viewmodel I do a find of the id that is passed for the edit link. If I use the fields in that model, I sometimes get an error if the value is null and sometimes don't. I get an error on the same field, nvarchar(100), and other fields, nchar(10), I don't get the error. I don't know why, other than maybe the nchar(10) nulls are being treated differently?

        ViewBag.TimeRec = Time.Min + "-" + Time.Max +
            "-" + Time.Rate.ToString() + "-" +
            Time.Description.ToString().Trim();

The Time.Min and Max are both null, in the mssql DB table they are nchar(10), the Description is also null nvarchar(100). When I change it to test the Description and then replace it with a variable that contains "", no error is thrown.

I did a search and can't find any answer. Thanks

Related posts

Recent Viewed