>>>Hi all,
>>>
>>>I need to verify a DataRow has valid values and thus I am checking my PK which is a Guid.
>>>
>>>I am doing this:
>>>
>>>if ((Guid)dr["Track_Id"] != null || (Guid)dr["Track_Id"] != Guid.Empty)
>>>{
>>>
>>>}
>>>
>>>
>>>I am getting a message "Unreachable expression code detected" on the last portion of the check.
>>>
>>>Is there a better way to verify a DataRow has values than this? Why would the second check be unreachable?
>>>Thanks
>>>Tim
>>
>>Why do you need to convert it to GUID? Can you just check for NullEndEmpty using String class static method?
>
>I didn't think I was converting it to a Guid. The column is a guid, but I thought I had to cast it as it is a Guid. I know if a column is an int I have to do a int.Parse() to get that value out.
>I didn't think about using the ToString() method to check its value. I was hoping there was a built in method of checking that a DataRow had values though.
>Tim
I don't know, that was just a quick thought. BTW, is it Web or Windows app? I think we need to have here this information in .NET section. Michel, would it be possible to add it?
Thanks.
If it's not broken, fix it until it is.
My Blog