PowerBuilder ‘Gotcha’ – Column lists do not match
This is more of a database driver error but I encountered it within a datawindow I was working on so PB gets credit.
I was working on a generic data drill down control which has a filtering process to eliminate data based on a date argument. Since I also wanted this date value for other purposes (expressions) on the datawindow I decided to include it within the result set. There are a variety of ways to do the same thing but this is what I fixated on while figuring out the control’s functionality. Initially my SQL was something like this (MS SQL Server 2008):
... ,IsNull(part_name, 'No Part') AS part_name ,:adt_date AS svc_date ...
Everything is fine but during my testing I encountered the message: “Select Error: Column lists do not match.”
Hmmm…
Running a SQL trace gave this result for the query:
... ,IsNull(part_name, 'No Part') AS part_name ,NULL AS svc_date ...
So my date argument in this case was null. I could code in PowerBuilder to ensure the paramenter is always populated with a date but I preferred to following:
... ,IsNull(part_name, 'No Part') AS part_name ,IsNull(:adt_date, Getdate()) AS svc_date ...You might also be interested in