Microsoft KB Archive/294167

= FIX: AV with SQLOLEDB Provider When PRINT Statement in Stored Procedure Returns More Than 512 Bytes of Data =

Article ID: 294167

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.5 Service Pack 1

-



This article was previously published under Q294167



SYMPTOMS
With the SQLOLEDB provider that ships with MDAC version 2.5 or 2.5 SP1, calling a Microsoft SQL Server stored procedure with one or more PRINT statements that return more than 512 bytes of data each may result in an access violation. The error message may be as follows:

The instruction at &quot;0x7538127d&quot; referenced memory at &quot;0x3300400d&quot;. The memory could not be &quot;read&quot;.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in MDAC 2.6.



Steps to Reproduce Behavior
  Create the following stored procedure with a PRINT statement returning 700 bytes of data in the SQL Server Northwind database: CREATE PROCEDURE sp_Test2 AS set nocount on declare @HTMLoutputx varchar(1000) select @HTMLoutputx = ''

WHILE LEN(@HTMLoutputx) <= 700 BEGIN select @HTMLoutputx = @HTMLoutputx + 'TOO MUCH TEXT IS BAD!' END

PRINT @HTMLoutputx  Create a Microsoft Visual Basic standard EXE project and set the project reference to Microsoft ActiveX Data Objects 2.5 Library.  Add the following function and call it in Form.Load: Function Test

On Error GoTo MAIN_ERROR

Dim adocnn As ADODB.Connection Dim adocmd As ADODB.Command Dim adorst As ADODB.Recordset Set adocnn = New ADODB.Connection adocnn.CursorLocation = adUseClient adocnn.Open &quot;Provider=SQLOLEDB;Data Source=vcdb;Database=northwind;uid=sa;pwd=;&quot; Set adocmd = New Command With adocmd .CommandText = &quot;sp_Test2&quot; .CommandType = adCmdStoredProc .ActiveConnection = adocnn End With

' Execute the command. adocmd.Execute, , adExecuteNoRecords

Set adocmd = Nothing adocnn.Close Set adocnn = Nothing

Exit Function

MAIN_ERROR: MsgBox Err & &quot; - &quot; & Error$, vbCritical, &quot;CLASS:ReportCriteria,METHOD:LoadLists&quot; Exit Function

End Function  Run the code and you will see an access violation error returned.

Additional query words: AV SQLOLEDB PRINT Stored Procedure

Keywords: kbbug kbfix kbmdac260fix KB294167

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.