BUG: ODBC Getchunk Method on Non-Memo Field Causes GPF/UAE
ID: Q97082
|
The information in this article applies to:
-
Microsoft Visual Basic Professional Edition 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
- Start the Professional Edition of VB.EXE with ODBC support already
installed.
- 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
- 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 query words:
buglist2.00 2.00 GPF
Keywords :
Version :
Platform :
Issue type :