Re: casting type for objectGuid
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 05/27/05
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: How to get LDAP directory server"
- In reply to: dl: "casting type for objectGuid"
- Next in thread: dl: "Re: casting type for objectGuid"
- Reply: dl: "Re: casting type for objectGuid"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 27 May 2005 09:48:05 -0500
In AD/S.DS, objectGUID is returned from a DirectoryEntry or SearchResult as
a byte array. You would want to cast that to a byte array, then pass that
byte array to the constructor on a Guid structure. That will give you a
valid .NET Guid.
I can't remember the exact syntax to pass it into SQL to get it set up as a
UniqueIdentifier column (which is the correct SQL type for a GUID), but as I
recall, you pass it in your query as a String. Call the ToString method on
the Guid to get this.
HTH,
Joe K.
<dl> wrote in message news:Olh5aApYFHA.3220@TK2MSFTNGP14.phx.gbl...
> Hi
> I am trying to put a user's objectGuid as the primary key onto a datatable
> and be used as the unique key on editing / updating. But I seem to get
> casting error with the following statement
> dt.Columns.Add(new DataColumn("object_Guid", typeof(string)));
>
> Any idea?
>
> TIA
>
> --
>
>
>
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: How to get LDAP directory server"
- In reply to: dl: "casting type for objectGuid"
- Next in thread: dl: "Re: casting type for objectGuid"
- Reply: dl: "Re: casting type for objectGuid"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|