Our backend database is MS SQL server 2000.
I have a form that on open calls for
databaseManager.setAutoSave(false);
In this form I have a button called Save
var message = "";
message += 'Do you want to save the change?\n'
var thePressedButton = plugins.dialogs.showInfoDialog( 'Result', message, 'OK', 'No')
if (thePressedButton != 'OK')
{
databaseManager.rollbackEditedRecords()
controller.loadOmittedRecords();
return;
}
else if (thePressedButton == 'OK')
{
databaseManager.saveData()
message += 'Record saved.\n';
controller.loadOmittedRecords();
}
When users call the above Save method.
If there is any error from backend such as duplicated record or not matching the table criteria, Servoy client does not inform the users about any error from backend database and then Servoy client hangs.
Is there any way at least to let users know that there was some error with backend or something that informs users that there is an error instead of doing nothing.
var message = "";
databaseManager.saveData();
//Get the failed records after a save
var array = databaseManager.getFailedRecords()
for( var i = 0 ; i < array.length ; i++ )
{
var record = array[i];
var alert = application.output(record.exception);
//message += '+ array[i] +'
plugins.dialogs.showErrorDialog( "Error", "Error saving redord", 'OK');
}
In servoy Debuger output I see:
com.servoy.j2db.dataprocessing.DataException: Violation of PRIMARY KEY constraint 'PK_IMG_Excel'. Cannot insert duplicate key in object 'IMG_Excel'.
I triyed to show the debuger output to the client screen via plugins.dialogs.showErrorDialog, but no success.
Is there a way to show the debugger out put to the client screen?
Am I going to the right path here or there is another way of doing this?