Column order in data source and Column Specification

It is not a PowerBuilder best practice for the columns in the data source to be in a different order from the columns in the Column Specification.

If the columns listed in the data source and in the Column Specification are not in the same order, the data retrieval will fail in the .NET server.

Suppose the data source is

SELECT "employee"."emp_id","employee"."emp_fname","employee"."start_date" FROM "employee"

If the column specification is changed from

table(column=(type=long update=yes updatewhereclause=yes key=yes name=emp_id dbname="employee.emp_id" )
column=(type=char(20) update=yes updatewhereclause=yes name=emp_fname dbname="employee.emp_fname" )
column=(type=date update=yes updatewhereclause=yes name=start_date dbname="employee.start_date" )

to

table(column=(type=long update=yes updatewhereclause=yes key=yes name=emp_id dbname="employee.emp_id" )
column=(type=date update=yes updatewhereclause=yes name=start_date dbname="employee.start_date" )
column=(type=char(20) update=yes updatewhereclause=yes name=emp_fname dbname="employee.emp_fname" )

then the DataWindow will be converted incorrectly to the model.

[Key]
[DwColumn("employee", "emp_id")]
public int? Emp_Id { get; set; }
[ConcurrencyCheck]
[DwColumn("employee", "emp_fname", TypeName = "char")]
public string Start_Date { get; set; }
[ConcurrencyCheck]
[DwColumn("employee", "start_date")]
public DateTime? Emp_Fname { get; set; }

And the following error will occur when retrieving data in the application:

sqlerrtext=Invalid object name 'employee'.