>>>Try getting a Value and also compare it first with DbNull.Value
>>>
>>
>>Hi Naomi,
>>
>>I'm not sure what you mean by the above. The problem I am having is that a default value is not getting populated when it should be by the framework I am using (MM.NET). I assume this is due to me having forgotten to set something as it works elsewhere.
>
>My suggestion was to overcome the error. In order for the cast to be valid, you need to use Value property of the Ds.Row and also you need to make sure it's not null.
OK. I have fixed the problem. I realised I had generated my business layer for this table once without setting the default value and then with an incorrect name. So I was seeing the default setting code, but it was in the wrong class. Once I fixed that everything works.
Thanks for your time