Connect to database
-
AndreyZ
Re: Connect to database
It's good to see that you've found a solution. If any other questions come up, please contact us.
Re: Connect to database
Hmmm?
Where do you get the ErrorCode-parameter from?
I'd like to determine if the target path was the problem or the server name and parsing the error message doesn't seem wise in a multi-language environment
Thanks!
Where do you get the ErrorCode-parameter from?
I'd like to determine if the target path was the problem or the server name and parsing the error message doesn't seem wise in a multi-language environment
Thanks!
marsheng wrote:This seems to workCode: Select all
try MyConnection1.Connected:=True; except on E: EMyError do begin if e.ErrorCode = 1045 then ShowMessage('Invalid Server Address or Password') ... end; else ShowMessage('Unknown error'); end; end;
-
AndreyZ
Re: Connect to database
The EMyError.ErrorCode property determines the error code returned by the server. You can find more information about MySQL error codes here:
http://dev.mysql.com/doc/refman//5.5/en ... dling.html
http://dev.mysql.com/doc/refman//5.5/en ... erver.html
http://dev.mysql.com/doc/refman//5.5/en ... lient.html
http://dev.mysql.com/doc/refman//5.5/en ... dling.html
http://dev.mysql.com/doc/refman//5.5/en ... erver.html
http://dev.mysql.com/doc/refman//5.5/en ... lient.html
Re: Connect to database
That's fine, but when I use IBDac and Delphi, there is no EMyError - classtype. And the TException-class doesn't provide this property.AndreyZ wrote:The EMyError.ErrorCode property determines the error code returned by the server. You can find more information about MySQL error codes here:
http://dev.mysql.com/doc/refman//5.5/en ... dling.html
...
-
AndreyZ
Re: Connect to database
Every DAC has its own exception class. In IBDAC, you can use the EIBCError class that has the ErrorCode property. For more information about the EMyError and EIBCError classes, please refer to the MyDAC and IBDAC documentation.
Re: Connect to database
I basically created an error and found the message and then wrote the code.
A bit simpler than wading through piles of guff on the web.
I have just been on a seminar with DR Rob Adams, author of IF I BUILD IT WILL THEY COME.
Every programmer should attend his lecture or read his book.
We do things backwards. We should be asking people what they want rather than telling them what they need. Life would be so much simpler.
Have you wondered why Delphi after 10+ years in the field still does not have a numeric input component.
That's enough waffle for today.
A bit simpler than wading through piles of guff on the web.
I have just been on a seminar with DR Rob Adams, author of IF I BUILD IT WILL THEY COME.
Every programmer should attend his lecture or read his book.
We do things backwards. We should be asking people what they want rather than telling them what they need. Life would be so much simpler.
Have you wondered why Delphi after 10+ years in the field still does not have a numeric input component.
That's enough waffle for today.