Output parameters are not returned when you run an ADO.NET command in Visual Basic (308051)
The information in this article applies to:
- Microsoft ADO.Net 2.0
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic 2005
This article was previously published under Q308051 For a Microsoft Visual C# .NET version of this
article, see
308621. For a Microsoft Visual C++
.NET version of this article, see
308624. This article refers
to the following Microsoft .NET Framework Class Library namespaces:
- System.Data
- System.Data.OleDb
- System.Data.SqlClient
SYMPTOMS Output parameters do not appear to be initialized or return
a wrong value when executing an ADO.NET command. CAUSE This problem can occur for the following reasons:
- Output parameters are returned at the end of the data
stream when using a DataReader object.
- The Direction property of the parameter is not set properly.
RESOLUTION- When using a DataReader, you must close it or read to the end of the data before the
output parameters are visible.
- Make sure that the Direction property of the parameter is set to Output, or InputOutput if the
parameter is used in the procedure to both send and receive data.
NOTE: The parameter object for the return value must be the first item
in the Parameters collection. Also make sure that the parameter's data type matches
the expected return value. STATUSThis
behavior is by design.REFERENCESFor additional information, click the article number below 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: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbtshoot kbnofix kbprb kbSqlClient kbSystemData KB308051 kbAudDeveloper |
---|
|