PRB: Unhandled Exception When You Set ADO Property to a String in Visual C# .NET (309047)
The information in this article applies to:
- Microsoft .NET Framework
- Microsoft Visual C# .NET (2002)
This article was previously published under Q309047 For a Microsoft Visual Basic .NET version of this article, see 308499.
SYMPTOMS
When you set a property value on an ActiveX Data Objects (ADO) object to a string value, you may encounter the following exception:
Unhandled Exception: System.Runtime.InteropServices.COMException (0x800A0BB9): Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
CAUSE
When you use ADO in the Microsoft .NET Framework with Component Object Model (COM) interop, ADO properties that formerly accepted either object references or string values now only support object references. As a result, when you try to set a property to a string value, an exception is thrown.
RESOLUTION
To set an ADO property that accepts either an object or a string to a string value in the .NET Framework, use the let_ methods that COM interop generates for imported assemblies. For sample code that demonstrates this, refer to the "More Information" section.
Modification Type: | Major | Last Reviewed: | 10/23/2003 |
---|
Keywords: | kbnofix kbprb KB309047 |
---|
|