Results 1 to 8 of 8

Thread: Guid HELP!!!!!!!!!! [Some what resolved]

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Guid HELP!!!!!!!!!! [Some what resolved]

    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

    PHP Code:
    if(key != System.Data.SqlTypes.SqlGuid.Null
    Last edited by Magiaus; Aug 16th, 2004 at 01:09 PM.
    Magiaus

    If I helped give me some points.

  2. #2

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    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

    If I helped give me some points.

  3. #3

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    okay the .Empty doesn't work either
    Magiaus

    If I helped give me some points.

  4. #4

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    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

    If I helped give me some points.

  5. #5

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    _key.ToString() != "Null"

    seems to work

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

    If I helped give me some points.

  6. #6

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    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

    If I helped give me some points.

  7. #7

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    exactly "00000000-0000-0000-0000-000000000000"
    Magiaus

    If I helped give me some points.

  8. #8

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    PHP Code:
            /// <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;
                }
            } 
    Last edited by Magiaus; Aug 16th, 2004 at 01:59 PM.
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width