With MySql, we can grant certain users certain permissions on a database or table or field. If a user tries to do something he is not supposed to do, how can we get the MyDac components to get these permission messages back to Delphi and our programs to present them to the users.
Can you give me coding examples?
Permissions and Messages from MyDac
You can catch EMyError exceptions in try..except statements. Use EMyError.ErrorCode to know the error code.
For more information about the error code read the MySQL Reference Manual.
For example:
For more information about the error code read the MySQL Reference Manual.
For example:
Code: Select all
try
MyTable.Post;
except
on E: EMyError do
if E.ErrorCode = 1142 then //ER_TABLEACCESS_DENIED_ERROR
ShowMessage('Access to a server object denied.'#13#10 + 'Message: ' + E.Message)
else
raise;
end;