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
- Using Visual J++, create a new empty project. Add a new WFC Form to the
project.
- Add a DataSource to the Form by dragging a DataSource control over from
the Toolbox.
- 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.
- A "Data Link Properties" dialog box will appear. Click the Provider
tab and select "Microsoft Jet 3.51 OLE DB Provider."
- 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.
- Click on the Test Connection button to test the data source.
- Click OK.
- 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.
- In Properties for the DataSource, select the cursorLocation property
and choose the value Server.
- Add a DataGrid control to the Form by selecting the DataGrid control
from the Toolbox and dragging out its shape on the Form.
- 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.
- Run the application.
- 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: July 9, 1999