Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for valid Guid in DataRow
Message
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349517
Message ID:
01349545
Views:
11
>>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.
>
>Second expression would only be evaluated if (Guid)dr["Track_Id"] evaluated to null . I guess you intended &&......

Nice catch!
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform