I have the following code in a C# class library method:
// GUID VERSION
Guid gUserID = new Guid(sUserID);
Guid gAuthorityID = new Guid(AuthorityID);
oCommand.Parameters.Append(
oCommand.CreateParameter("@authorityid",
ADODB.DataTypeEnum.adGUID,
ADODB.ParameterDirectionEnum.adParamInput,
System.Runtime.InteropServices.Marshal.SizeOf(gAut horityID),
gAuthorityID));
oCommand.Parameters.Append(
oCommand.CreateParameter("@userid", ADODB.DataTypeEnum.adGUID,
ADODB.ParameterDirectionEnum.adParamInput,
System.Runtime.InteropServices.Marshal.SizeOf(gUse rID),
gUserID));
The code used to use Integer values instead of GUID values. here is
what it used to look like:
// INT VERSION
// AuthorityID was a public int property
// nUserID was an argument supplied in the method call
oCommand.Parameters.Append(
oCommand.CreateParameter("@authorityid",
ADODB.DataTypeEnum.adInteger,
ADODB.ParameterDirectionEnum.adParamInput,
System.Runtime.InteropServices.Marshal.SizeOf(Auth orityID),
AuthorityID));
oCommand.Parameters.Append(
oCommand.CreateParameter("@userid", ADODB.DataTypeEnum.adInteger,
ADODB.ParameterDirectionEnum.adParamInput,
System.Runtime.InteropServices.Marshal.SizeOf(nUse rID),
nUserID));
The old code worked just fine, but the new code generates a Stack
Overflow error. I tried putting the two methods in a try / catch block,
but it failed to cause an actual exception, so I'm not sure what
exactly is causing the overflow in the GUID version. Any ideas? Is it
that .NET GUID class doesn't play well with the ADO objects?
Any help is appreciated,
Jason