Re: Multi-step OLE DB operation error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 07/19/04


Date: Mon, 19 Jul 2004 14:01:37 -0400

Ugh, why all this code? Why a command object and a recordset object?

sql = "SELECT Extended_Notes FROM table" ' where ... ?
' or sql = "EXEC proc that SELECTs Extended_Notes"
set rs = conn.execute(sql)
eNotes = rs(0)
' ...
response.write eNotes

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"Tyrel Schroeder" <TyrelSchroeder@discussions.microsoft.com> wrote in
message news:B4311675-A0C2-4AF8-83CE-0A00AF890776@microsoft.com...
> I've been trying to get data from an MSSQL database that has a text data
type column.  I'm using the GetChunk method (after verifying that adFldLong
is set) and keep getting the following error message:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
> Multiple-step OLE DB operation generated errors.  Check each OLE DB status
value, if available.  No work was done.
>
> The code that is causing the error message is below (it's taken from
http://support.microsoft.com/default.aspx?scid=kb;EN-US;194975 but has been
modified a little):
>
> <!-- Code snipped from above -->
> RS2.Close
> RS2.CursorType = 1 'adOpenKeySet
> RS2.LockType = 3 'adLockOptimistic
> Set RS2 = cmd2.Execute
> If Not RS2.EOF Then
> While NOT RS2.EOF
>   If IsNull(RS2("Extended_notes")) Then
>         MyTextFile.WriteLine("problem here")
>   Else
>     If (RS2("Extended_notes").Attributes AND adFldLong) = adFldLong Then
>       BlobToFile(RS2("Extended_notes"))
>     End If
>   End If
>   RS2.MoveNext
> Wend
>
> Sub BlobToFile(fld) ' Modified from kbArticle
>   Dim sData, adLongVarChar, adLongVarWChar, FieldSize
>
>   adLongVarChar = 201
>   adLongVarWChar = 203
>
>   WriteFromUnsizedText fld ' Select statement eliminated here
> End Sub
>
> Sub WriteFromUnsizedText(fld)
>   Dim Data, Temp, BLOCK_SIZE
>
>   BLOCK_SIZE = 4096
>   Do
>     Temp = fld.GetChunk(BLOCK_SIZE) ' Error occurs here
>     If IsNull(Temp) Then Exit Do
>     Data = Temp
>     Response.Write(Data)
>   Loop While Len(Temp) = BLOCK_SIZE
> End Sub
>
> Any help would be greatly appreciated.  Thanks in advance.


Relevant Pages

  • RE: Argument not optional
    ... The problem is that the error message comes directly after I have ... sub so there must be something strange with the button. ... message "Argument not optional" (as I had not selected any charts but I ... ''' msoButtonAutomatic, msoButtonIcon, msoButtonCaption, ...
    (microsoft.public.excel.programming)
  • RE: Code For Required Fields
    ... > the error message and exit the subroutine. ... Private Sub Form_BeforeUpdate ... > Private Sub Form_BeforeUpdateDim ctl As Control For Each ...
    (microsoft.public.access.formscoding)
  • Re: [VB5] error 5 on unload form
    ... Was the error announced in a msgbox of your own, ... contain no error handling (I am aware of the error handling in case ... You asked for the origin of the error message. ... The sub in the main module is executed to its very end, ...
    (comp.lang.basic.visual.misc)
  • Re: 2105 says: "You cant go the specified record"
    ... >> End Sub ... which doesn't result in the 2105 error message. ... >> when using this vba code in my main form and i modify the control's ... >> Dim Future_Visit As Date ...
    (microsoft.public.access.formscoding)
  • Re: Handling "exit" without error msg
    ... Sub Form_Close ... Error message to be generated and then respond accordingly. ... One method to "catch" users closing the window is to force them to close the ... Private mflgClose As Boolean ...
    (microsoft.public.access.formscoding)