473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

issues passing GUID as classic ADO input parameter?

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

Nov 17 '05 #1
0 1502

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Max Ischenko | last post by:
I'm using adodbapi DBAPI module to access SQL server and trying to pass a GUID parameter with an SQL statement. But it doesn't work: I got "incorrect cast expression" from the ADO. If I paste GUID...
2
by: jason | last post by:
Hello everyone, I have a C# object library which encapsulates data. Data is keyed by way of Guid values, which are stored in the objects as read-only Guid properties. However, we have a...
3
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
0
by: shapper | last post by:
Hello, I am trying to define an ObjectDataSource delete parameter. The parameter name is "TagID" and is a Guid: ObjectDataSource1.DeleteParameters.Add(new Parameter("ID", TypeCode.Object)) ...
3
by: Elan Dro | last post by:
How we can pass the structure type (GUID) as value parameter to the object using reflection setValue method of FieldInfo, PropertyInfo and etc Ex : Public Class A Public GUIDField as GUID End...
0
skeptics
by: skeptics | last post by:
Trying to pass a SafeArray that i get form Request.BinaryRead Method in classic asp to a c# com interop component. In this thread i found a solution to pass and cast a normal asp safearray in to a c#...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.