Data Access and SQL > SQL Data Sources > Working with an SQL Data Source > Forcing the Name of a Column
 
Forcing the Name of a Column
When a table is added to an SQL data source and the columns of the underlying table object are specified, you will notice that the name of the column is automatically set. It is automatically set to the name of the database table column. In most situations, this behavior is acceptable. However, there are certain situations when it can be useful to be able to change this name.
You may have noticed in the Rogue Wave Views Data Access Getting Started Manual that when an additional table is added to the data source, any columns that are not uniquely named are prefixed by the table name they originate from.
Figure 8.11    An SQL Data Source with Two Database Tables Showing Automatic Column Naming
If you have already set up a number of gadgets that are linked to columns and then add another table to the data source, certain table column names can change. This will have an effect on any gadgets tied to these columns. The gadget will fail to locate the column it is tied to because the column name has changed.
To work around this problem, specify a specific column name in the Datatype page of the SQL Data Source inspector. Providing you do not create any ambiguities, you can type the original column name here. Any gadgets connected to the column will then be updated to show the values in the column.
Figure 8.12    Forcing the Name of a Column Using the Datatype Page
Note: The table gadget is the only gadget whose column names change dynamically with the data source.
If you leave the Name field empty, the column name will change automatically to avoid any ambiguity whenever a new table is added.

Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.