Board index » delphi » Ms sql 2000 login

Ms sql 2000 login

Using Adoexpress D6 and mssql 2000 how he can handle this situations:

 - sql server doesnt exist.
 - user name or password invalid

thanks for help

Vimar

 vitorma...@softhome.net

 

Re:Ms sql 2000 login


On Thu, 28 Feb 2002 13:59:14 -0000, "vimar" <vitorma...@softhome.net>
wrote:

Quote
>Using Adoexpress D6 and mssql 2000 how he can handle this situations:
> - sql server doesnt exist.
> - user name or password invalid

Use this code snippet:

try
   ADOConnection1.Open;

except
  on E : EOleSysError do begin
     ShowMessageFmt('Error $%x - %s', [E.ErrorCode, E.Message]);
  end;
end;

This will try to open the database connection, with the supplied ADO
Connection string, and if it fails, you'll get an error (which gets
displayed).

In a next step, once you know what error codes you get for each case,
you can trap those specifically and handle them in whatever way you
see fit.

Marc

------------------------------------------------------------------------
Marc Scheuner                                          Software Engineer
Quest Software Canada                       Halifax, Nova Scotia, Canada
Email: marc.scheu...@quest.com                      http://www.quest.com

Other Threads