BUG: ODBC Getchunk Method on Non-Memo Field Causes GPF/UAE

Last reviewed: June 21, 1995
Article ID: Q97082
The information in this article applies to:
  • The Professional Edition of Microsoft Visual Basic for Windows, version 2.0

SYMPTOMS

Attempting to use the GetChunk method on a Text field or any field that has a data type other than Memo results in an unrecoverable application error (UAE) or a general protection (GP) fault.

CAUSE

The GetChunk method returns a string that represents all or a portion of

   a Memo field and only a Memo field in a specified dynaset.

WORKAROUND

To avoid the problem, use code to ensure that the field is a Memo field before you call the GetChunk method. For example, replace the following line shown in step 2 of the More Information section of this article:

   string1$ = ds(ds.Fields(NonMemoFieldNum%).Name).GetChunk(0, 50)

with this code:

   If ds.Fields(NonMemoFieldNum%).type = 12 Then
      string1$ = ds(ds.Fields(NonMemoFieldNum%).Name).GetChunk(0, 50)
   End If

STATUS

Microsoft has confirmed this to be a bug in the Professional Edition of Microsoft Visual Basic version 2.0 for Windows. We are researching this problem and will post new information here in the Microsoft Knowledge base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start the Professional Edition of VB.EXE with ODBC support already installed.

  2. Add the following code to the Form_Click event procedure of Form1:

    Form_Click ()

          Dim db As database
          Dim ds As dynaset
    

          ServerName$ = "aServerName"  ' Provide the name of a real server.
    
          DBName$ = "aDatabase"        ' Name of a database on the server.
          TableName$ = "aTable"        ' Name of a table in the database.
          UserName$ = "aUser"          ' login id
          PW$ = ""                     ' password
          NonMemoFieldNum% = 1  ' This could be any field in the table that
                                '  is not of type "Memo".
    
          'Connect to the SQL database
          Connect$ = "UID=" + UserName$ + ";PWD=" + PW$ + ";DBQ=" + DBName$
    
          Set db = OpenDatabase(ServerName$, False, False, Connect$)
    
          Set ds = db.CreateDynaset(TableName$)
          ' GP fault occurs on the following line:
          string1$ = ds(ds.Fields(NonMemoFieldNum%).Name).GetChunk(0, 50)
       End Sub
    
    

  3. Press the F5 key or ALT+R+S, and click Form1.

This results in a GP fault usually at address 0009:08EC in VBODBCA.DLL.


Additional reference words: buglist2.00 2.00 GPF
KBCategory: kbinterop kbprg kbbuglist
KBSubcategory: APrgDataODBC


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.