dohamsg
09-23-2008, 07:49 AM
MSSQL2005, Delphi2007.
Hi,
If the user forgets to input Employee Name, and tries to post the data, I don't want the database engine to raise the error <column Name doesn't accept Null Value>, instead I'd like to popup afriendly message like <Please enter an employee Name> and set input focus to the EmployeeName edit box from within Delphi.
I have written a stored procedure that does the error checking before posting the data, the problem I'm facing is that I can't localize messages inside stored procedure (English, French, Spanish...) since message texts are compiled inside the stored procedure.
I tried to map return values to messages, for example if returnValue = 0 <no error>, if = -1 <Duplicate Name>, if = -2 <EmployeeName is empty>...
This way from Delphi after catching the returnValue I popup a friendly localized message to the user; but no way, since a stored procedure can call another stored procedure and if returnValue = -2, I don't know which stored procedure returned that value!
I decided to move error checking from Stored Procedure to Delphi, if everything is OK, I call the stored procedure to post data.
Is this a good practice ?
I welcome any suggestion.
Many Thanks.
Hi,
If the user forgets to input Employee Name, and tries to post the data, I don't want the database engine to raise the error <column Name doesn't accept Null Value>, instead I'd like to popup afriendly message like <Please enter an employee Name> and set input focus to the EmployeeName edit box from within Delphi.
I have written a stored procedure that does the error checking before posting the data, the problem I'm facing is that I can't localize messages inside stored procedure (English, French, Spanish...) since message texts are compiled inside the stored procedure.
I tried to map return values to messages, for example if returnValue = 0 <no error>, if = -1 <Duplicate Name>, if = -2 <EmployeeName is empty>...
This way from Delphi after catching the returnValue I popup a friendly localized message to the user; but no way, since a stored procedure can call another stored procedure and if returnValue = -2, I don't know which stored procedure returned that value!
I decided to move error checking from Stored Procedure to Delphi, if everything is OK, I call the stored procedure to post data.
Is this a good practice ?
I welcome any suggestion.
Many Thanks.