Hopefully, someone has come across this issue before, as it has stumped a co-worker and I for a few days.
We successfully converted our project from PowerBuilder 12 Classic to PowerBuilder.NET and things are running decently, but we are experiencing an issue with how PowerBuilder.NET is reading the SQL syntax from a datawindow.
Opening up the datawindow, I copied the Syntax and pasted it into SQL Server 2008 R2, and it did all of it's retrieval. The SQL is below (note that some of the fields are removed to save space)
SELECT hl7_in.intf_app_parm_id,
hl7_in.sending_app,
hl7_in.msg_typ,
hl7_in.process_ind,
hl7_in.hl7_in_seq_no,
hl7_in.msg_evnt_typ,
hl7_in.wrng_msg_cnt,
pt.pt_middle_name,
hl7_in.resolved_ind,
hl7_in.pt_id,
hl7_in.hl7_msg_cntl_id,
hl7_in.msg_txt,
intf_app_parm.app_parm_desc,
intf_engine.engine_name
FROM {oj hl7_in LEFT OUTER JOIN pt ON hl7_in.pt_id = pt.pt_id}, {oj intf_app_parm LEFT OUTER JOIN intf_engine ON intf_app_parm.intf_engine_id = intf_engine.intf_engine_id}
WHERE ( hl7_in.intf_app_parm_id = intf_app_parm.intf_app_parm_id ) and
( ( intf_app_parm.direction_ind = 'I' ) )
But, when the code is executed during runtime, I get an SQL error (even though the SQL works)
SQLSTATE = 42000
Microsoft SQL Native Client
The multi-part identifier "intf_app_parm.intf_engine_id" could not be found
After trying to figure out what was causing the error (since both the joins on the above SQL work fine), I decided that we should check out the datawindow through the debugger. Well that's what we did, and we figured out why (Please see the below SQL):
SELECT hl7_in.intf_app_parm_id,
hl7_in.sending_app,
hl7_in.msg_typ,
hl7_in.process_ind,
hl7_in.hl7_in_seq_no,
hl7_in.msg_evnt_typ,
hl7_in.wrng_msg_cnt,
pt.pt_middle_name,
hl7_in.resolved_ind,
hl7_in.pt_id,
hl7_in.hl7_msg_cntl_id,
hl7_in.msg_txt,
intf_app_parm.app_parm_desc,
intf_engine.engine_name
FROM hl7_in LEFT OUTER JOIN pt ON hl7_in.pt_id = pt.pt_id
LEFT OUTER JOIN intf_engine ON intf_app_parm.intf_engine_id = intf_engine.intf_engine_id
WHERE ( hl7_in.intf_app_parm_id = intf_app_parm.intf_app_parm_id ) and
( ( intf_app_parm.direction_ind = 'I' ) )
If you take a look at the FROM statement, you will see that PowerBuilder decided to modify that statement by removing the comma (,) after pt.pt_id as well as the beginning part of the second join (intf_app_parm). We decided to check the original PB12 Classic code to see maybe it was a problem there too, but this strange thing doesn't happen there (the retrieve statement is read correctly).
The datawindow itself is not modified at any point during the application, nor is the SQL statement modified either. Anyone that has had experience with PowerBuilder.NET ever see this happen? If so, what did you do to fix the issue (this is happening on more than one data window).
Thank you for your time!