PDA

Click to See Complete Forum and Search --> : Guid HELP!!!!!!!!!! [Some what resolved]


Magiaus
Aug 16th, 2004, 11:19 AM
for some eason in .net when check for guid != System.Guid.Empty it doesn't care if there is a value it is empty....? Same for the SqlTypes guid

I can check the values while I'm in debug mode but the .Empty/.Null test doesn't seem to work

if(key != System.Data.SqlTypes.SqlGuid.Null)

Magiaus
Aug 16th, 2004, 12:39 PM
Okay.

guid != System.Guid.Empty works or seems to right now.
guid != System.Data.SqlTypes.SqlGuid.Null does not.

those are the same type of guid being tested btw.

so I am going to do guid.Value = System.Guid.Empty to see whats what

Magiaus
Aug 16th, 2004, 12:40 PM
okay the .Empty doesn't work either

Magiaus
Aug 16th, 2004, 12:41 PM
but if you covert the thing to a string and convert . null to a sting both will be "Null" so...... I'm comparing strings now

Magiaus
Aug 16th, 2004, 12:43 PM
_key.ToString() != "Null"

seems to work

but for a normal guid it's != "00000-0000-.......) all zeros

Magiaus
Aug 16th, 2004, 01:08 PM
in this project I create System.Guid from SqlGuid an SqlGuid from Guid. I have a dat layer with all SqlTypes and a Business layer with all System.Types

should I in my string check for "000000-0000-0000-0000" or whatever it is exactly?

Magiaus
Aug 16th, 2004, 01:12 PM
exactly "00000000-0000-0000-0000-000000000000"

Magiaus
Aug 16th, 2004, 01:41 PM
/// <summary>
/// Sort that mother****ing funcky donnet Guid.Empty and SqlGuid.Null **** out.
/// </summary>
/// <param name="guid">The ****ing guid.</param>
/// <returns>true/false</returns>
public static bool IsGuidNull(System.Data.SqlTypes.SqlGuid guid)
{
if((guid.ToString() == "Null") || (guid.ToString() == "00000000-0000-0000-0000-000000000000"))
{
return true;
}
else
{
return false;
}
}