Hard Code Native Error number in VB 6 program?
Posted on 2006-06-29
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,