See Also | Tutorials
When you bind a Table component to a database, you create
a connection between the Table component and a database
table. After you bind, check the table layout as desribed below to ensure that the columns are displayed in the correct order.
- Note: If two tables in a query have the same column names, you must make the column names
different to be able to use both database tables in a table component.
To set up the database
table and component:
- Add the table component to the page.
- If you are not connected to the database, in the Servers window, connect now.
- Expand the Tables or Views node to see the tables or views in the database.
To drop a database table on the Table component:
- Drag the database
table or view from the Servers window to the Visual Designer and
drop the database
table or view onto theTable component.
- Note: If you try to drop the database
table or view onto a cell in the Table component instead of the Table component
itself, the Choose Target dialog box appears asking you to choose the target. Choose the
Table component and click OK.
The Table component reformats to show the same
columns as the database table. See "To check and adjust the table layout" below.
To bind a Table component to a database
table that has already been added to the page:
- Select the entire Table component.
- Right-click and choose Bind to Data.
- In the Bind to Data dialog box, choose the data provider to which
you want to bind the Table component and click OK.
When the dialog box closes, the Table component reformats to show the same
columns as the database table.
To check and adjust the table layout:
- In the Visual Designer, right-click the border of the table
and choose Table Layout.
- In the Table Layout dialog box, select columns from the Available list on the left side.
- Move the columns to be displayed in your application to the Selected list by selecting each column and clicking the > button.
- Move the columns that you do not want to display out of the Selected list by selecting each column and clicking the < button.
- You can change the order of the columns by selecting a column and clicking Up or Down.
- When the Selected list shows the columns in the desired order, click OK.
In the Visual Designer, you see the columns displayed in the Table component. Each column shows
the data for the database column it displays.
- See Also
- About Binding Components to Data
- Bind to Data Dialog Box: Table Component
- About Components and Data
- Adding Components to a Page
- Adding a Data Source
- Adding Database Tables and Views to a Page
- JavaServer
Faces Expression Language
- Tutorials
- Using Table Components Tutorial
- Working With Databases Tutorial
- Using Databound Components to Access Databases Tutorial