Author: igregory, Posted: Wed May 25, 2005 1:11 pm Post subject: Storing binary SID in SQL Server ---- Hi,
I've a problem I'm struggling with related to SIDs. I'm adding a user interface to an xisting application which stores a Microsoft SID as a varbinary128 field in SQL server 2000. The application is running in a Sharepoint context on Server 2003 with active directory on a second server.
I need to get that binary SID into the SQL server table varbinary 128 field.
What I'm struggling with is how to get the binary in a format to get it into a parameter for a stored procedure. The only comparable issue I can find is saving BLOB fields which I understand can be passed using an array of data type byte which can then be passed to a binary field in the database. However I have no idea how to a) get my binary data from memory as defined by IntPtr into a byte array, b) pass a byte array to the stored procedure.
My code is:
In the class declarations
public string sid;
IntPtr _sid = IntPtr.Zero; //pointer to binary form of SID string.
int _error=0;