on 2016 Jun 02 7:13 AM
Hi PB Gurus!
I need your expertise again.
I have a fetch statement, it is working fine. I am able to fetch it and put it into a ddlb.
Now, I have a proxy table, I executed my query on the DB painter and it is ok also.
But when I tried a fetch and put it in a ddlb, nothing happens. What am I doing wrong?
Here is my sample code:
connect using SQLCA_PIS;
DECLARE xy CURSOR FOR
SELECT distinct internal_org_unit_name FROM dbo.prxy_org_internal_org order by internal_org_unit_name ;
OPEN xy;
FETCH xy INTO :v_div ;
DO UNTIL sqlca.sqlcode <> 0
ddlb_2.AddItem(v_div);
FETCH xy INTO :v_div;
LOOP
CLOSE xy;
TIA,
Because your embedded SQL (except for the connect using SQLCA_PIS;) statements do not specify a connection it uses SQLCA by default.
Assume you wanted to use SQLCA_pis and not SQLCA ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have an app that uses two different transaction objects. Neither is SQLCA. So to avoid annoying quiet failures I actually DESTROY SQLCA. I'd rather get a null reference object if I have forgotten to specify which database I wanted to consult than spend hours wondering why the thing don't work.
Of course good practice is to check SQLCode < 0 every time.
I sometimes have a function on the transaction object called notok() returning a boolean:
return ( this.SQLCode < 0 )
And a method that displays error after rolling back called fail():
string lsError
lsError = this.SQLErrText
ROLLBACK using this;
MessageBox ( 'Database Problem', lsError )
return -1
That enables
Update ..... Using SQLCA;
if SQLCA.NotOK() then return SQLCA.Fail()
Hi Ryan;
FWIW: I would suggest replacing all DDLB's with Drop Down DataWindow's (DDDW). No muss, no fuss, no cursors, no fetching, etc, etc.
Just my $0.02.
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.