Microsoft KB Archive/318681

= The Size property of the Output parameter is ignored when you use an OLE DB managed provider =

Article ID: 318681

Article Last Modified on 3/13/2006

-

APPLIES TO


 * Microsoft ADO.NET 1.0
 * Microsoft ADO.NET 1.1

-



This article was previously published under Q318681



SYMPTOMS
If you use an OLE DB managed provider, the OLE DB managed provider ignores the Size property set on an Output parameter if the type of parameter is LongVarChar, LongVarWChar, or LongVarBinary.



STATUS
This behavior is by design.



Steps to reproduce the behavior
In the following steps to reproduce the behavior, a Microsoft Visual Basic .NET Windows application connects to an Oracle database by using an OLE DB managed provider:   In Oracle SQL*Plus, create the following stored procedure: Create or Replace Procedure outparam(param1 out varchar2) as begin param1:='helllllllllllllloooooo'; end;  Create a new Microsoft Visual Basic .NET Windows Application. Make sure that your project contains a reference to the System.Data namespace. Place a Command button on Form1, and then change the button's Name property to btnTest.  Use the Imports statement on the System, System.Data, and System.Data.Oledb namespaces, so that you do not have to qualify declarations in those namespaces later in your code. Imports System Imports System.Data Imports System.Data.Oledb   Paste the following code in the code window after the region &quot;Windows Form Designer generated code&quot;: Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click Dim myConnString As String = _ &quot;Provider=MSDAORA;Data Source=myServer;user id=id;password=pwd;Persist Security info=False;&quot; Dim cnOra As New OleDbConnection(myConnString) Dim cmd1 As New OleDbCommand cmd1.CommandType = CommandType.StoredProcedure cmd1.Connection = cnOra cmd1.CommandText = &quot;outparam&quot; cmd1.Parameters.Add(&quot;test&quot;, OleDbType.LongVarChar, 2) cmd1.Parameters(&quot;test&quot;).Direction = ParameterDirection.Output cnOra.Open cmd1.ExecuteNonQuery MessageBox.Show(cmd1.Parameters(&quot;test&quot;).Value) cnOra.Close End Sub </li> Modify the Connection string (myConnString) as appropriate for your environment.</li> Save your project. On the Debug menu, click Start, and then run your project.</li> Click the button, and you see that the output parameter value that is returned is &quot;helllllllllllllloooooo&quot; instead of &quot;he&quot;.</li></ol>

<div class="references_section">