Link to home
Start Free TrialLog in
Avatar of misdevelopers
misdevelopers

asked on

Hard Code Native Error number in VB 6 program?

Using VB 6, sp6,
On sql server 2000 (sp4)

When I try to establish a connection to the database
from a VB 6 program using ADO, I get a similar message
if the UserID does not exist or if the UserID does exist
but does not have the permission to the database.

The NativeError number is different,

NativeError - 18456 The UserID does not exist
NativeError - 4060  The UserID exists, but does not have permission
                    to the database.

Can I hard code the NativeError number in my VB 6
program to determine exactly what happened,
(the UserID did not exist or the UserID does exist but
does not have the proper permission.)

I worry that the code number might change in a future
version of sql server.  

I hate to do this but there is no other way to determine
exactly what happened.

Thanks in Advance,

Laurencel



 
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial