Output parameters are not returned when you run an ADO.NET command in Visual C++ .NET (308624)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft ADO.Net 2.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q308624 Note Microsoft Visual C++ .NET (2002) supports both the managed code
model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model. The information in this article applies only to
unmanaged Visual C++ code. For a Microsoft Visual C# .NET version of this
article, see
308621. For a Microsoft Visual
Basic .NET version of this article, see
308051. This article refers
to the following Microsoft .NET Framework Class Library namespace:
SYMPTOMS When you run an ADO.NET command, the output parameters may
not be initialized, or they may return an incorrect value. CAUSE This behavior occurs if the direction of the parameter is
not set properly. Output parameters are returned at the end of the data stream
when you use a DataReader object. RESOLUTION To resolve this issue, do both of the following:
- When you use a DataReader implementation, be sure to close it or read to the end of the
data before the output parameters are visible.
-and- - Make sure that the direction of the parameter is set to Output or InputOutput (if the parameter is used in the procedure to to both send and
receive data).
Note Ensure that the parameter object for the return value is the
first item in the Parameters collection. Additionally, ensure that the parameter's data type
matches that of the expected return value. STATUSThis
behavior is by design.REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
308049
How to call a parameterized stored procedure by using ADO.NET and Visual Basic .NET
Modification Type: | Major | Last Reviewed: | 3/13/2006 |
---|
Keywords: | kbManaged kbnofix kbprb kbSqlClient kbSystemData KB308624 kbAudDeveloper |
---|
|