Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB error but SQLCA with sqlerrtext = null OR blank

Status
Not open for further replies.

hareshchauhan

Programmer
Jan 30, 2007
3
US
Hi i am new to this forum. I will really appreciate if someone could give me a little tip on powerbuilder SQLCA transaction object. Thank you in advance, here is my problem.

return_code = dw_1.update()
//Getting return_code = -1
if return_code = -1 then
// display error message with sqlca.sqlcode and sqlca.sqlerrtext
//I am getting sqlca.sqlcode = 0
//I am getting sqlca.sqlerrtext = null
end if

I should get sqlcode <> 0 and something in sqlerrtext when update() returns -1.

Here is my environment info.

powerbuilder 9.0.2
oracle 8i
windows XP

thanks again....


 
Put a stop in the debugger after your update statement and look at the values in the SQLCA item for clues as to what is wrong.

Matt

"Nature forges everything on the anvil of time
 
hi,

check your datawindow if the update property is set to "yes". it seems to be set to "no". the update function returns -1 if set to "no". therefore no update is done to database and sqlca is the same before and after dw.update()
 
Hi,

Do not check the transaction object properties when you are using datawindows functions
Use the return code of update()


Check transaction properties when you use embedded sql
SQLCode, SQLDBCode & SQLErrText
 
Attention!!!!

do not believe deadsoul1. Awefull hint he did!!

IT IS ALWAYS A GOOD IDEA TO CHECK THE TRANSACTION OBJECT !
----------------------------------------------------------

dw.update() only returns -1 if something does not work. the real reason is not returned. and there can be many reasons

eg. double primary key, referencial integrity reasons, values out of scope. not valid values. eg null on a column where not allowed.... etc.
 
Thank you all for your help, I have resolved this issue.
I have created to instance variable one for sqlcode and other for sqlerrortext. these two variables are getting value from dberror event. SOMETIME POWERBUILDER DO NOT SEND SQLCODE AND SQLERRORTEXT. I had a sqlcode code checking right after UPDATE(), I was getting update()= -1, sqlcode = 0 and sqlerrortext = '',
I had a "Primary key violation" database error.For this error I was expecting sqlcode = -1 and sqlerrortext="some error message". But I wasn't getting it.

Now I am getting code and actual error text from DBerror event using instance variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top