BUG: WFC DataGrid Control Fails When Displaying a Binary Column

ID: Q195528


The information in this article applies to:
  • Microsoft Visual J++, version 6.0
  • Microsoft SDK for Java, versions 3.1, 3.2


SYMPTOMS

An attempt to display a binary field in a Windows Foundation Classes (WFC) DataGrid control may cause an Application Error.


CAUSE

An underlying call to field.getString() fails.


RESOLUTION

Avoid using the DataGrid control to display binary data, if possible.

If you are writing code that directly manipulates binary fields, use field.getValue() instead of field.toString().


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Using Visual J++, create a new empty project. Add a new WFC Form to the project.


  2. Add a DataSource to the Form by dragging a DataSource control over from the Toolbox.


  3. In the Properties pane for the DataSource, set the connectionString property by selecting that field and clicking on the "..." button. Select a database that contains a binary field. You can follow these steps if you have Microsoft Access and the Northwind sample database installed.
    1. A "Data Link Properties" dialog box will appear. Click the Provider tab and select "Microsoft Jet 3.51 OLE DB Provider."


    2. Click Next or the Connection tab. Type in the path to the Northwind database, or click the "..." button to browse for it. The Northwind database is commonly located at C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb.


    3. Click on the Test Connection button to test the data source.


    4. Click OK.




  4. In Properties for the DataSource, select the commandText property and type in a command string that describes a table with binary data in at least one column. If you are using the Northwind database, you can type in select * from employees.


  5. In Properties for the DataSource, select the cursorLocation property and choose the value Server.


  6. Add a DataGrid control to the Form by selecting the DataGrid control from the Toolbox and dragging out its shape on the Form.


  7. In the Properties pane for the DataGrid, select the dataSource property and choose the DataSource you added in step 2.

    NOTE: Data from the database will appear in the DataGrid, and Visual Studio may stop if a field with binary data is visible at this point.


  8. Run the application.


  9. Scroll the DataGrid to reveal the column with binary data. If you are using the Northwind database as described above, this will be the Photo column.




At this point, the program attempts to access memory that is invalid. You will see a dialog box similar to the following:
WJView.exe - Application Error The instruction at "0x7c01254d" referenced memory at "0x056f2000". The memory could not be "read". Click on OK to terminate the application Click on CANCEL to debug the application"


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Derek R. Smith, Microsoft Corporation

Additional query words:

Keywords : kbInternet kbJava kbVJ600bug kbSDKJava310 kbwfcui kbSDKJava320
Version : WINDOWS:3.1,6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: November 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.