Skip to Content
avatar image
Former Member

.NET assembly not getting invalid row/column system error with GetItem, SetItem

I am running into a problem where the .NET assembly created in Powerbuilder 12.6 classic. On a datastore, if there is an error when calling

GetItemxxxx or SetItem, the systemerror event is not triggered.

Here is sample code for GetItemString
datastore lds_example
string ls_Value

lds_example = create datastore
lds_example.dataobject = 'd_column_type_example'
lds_example.InsertRow(0)
ls_Value= lds_example.GetItemString(1, 'bad_column')
DESTROY lds_example
RETURN ls_Value

When this code runs in a Powerbuilder application, the systemerror event is triggered and the method does not complete. When this code runs from

a .NET assembly, the systemerror event does not run, the method completes and returns an empty string. If I use a TRY-CATCH block, it does not go to the Catch (i.e. no exception is

raised).

For SetItem, here is sample code
integer ll_rc
long ll_row
datastore lds_example

lds_example = create datastore
lds_example.dataobject = 'd_column_type_example'

TRY
ll_row = lds_example.InsertRow(0)
ll_rc= lds_example.SetItem(ll_row, 'bad_column','new value')
IF ll_rc < 0 THEN
runtimeerror lrte
lrte = CREATE runtimeerror
lrte.setmessage( "SetItem failed in " + this.Classname( ) + ' method of_SetItem_BadColumn')
THROW lrte
END IF
FINALLY
DESTROY lds_example
END TRY
RETURN

When this code runs in a Powerbuilder application, the systemerror event is triggered and the code for checking the return code is never reached.

When this code runs from a .NET assembly, the setitem returns -1 and the code for throwing the RunTimeError is reached. The runtime error

becomes an exception in .NET.

Shouldn't the exception be raised on the .NET side? Checking the return code on the SetItem works around that part of the problem but with

GetItem, checking for empty string does not make sense. Does anyone know a work around for this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers