Friday, February 17, 2012

Error 21776: After creating new login

I run this code:
EXEC DATA0003.dbo.sp_addlogin 'test','pwd'
EXEC DATA0003.dbo.sp_grantdbaccess 'test'
EXEC DATA0003.dbo.sp_addrolemember 'Full','test'
When I go into enterprise and go to the properties of
login and to Data Access Tab and select the Data0003
(which is checked) I get this error:
Error 21776:[SQL-DMO]The name 'test' was not found in the
Users collection. If the name is a qualified name, use
[] to separte various parts of the name, and try again.
The only way I found to get rid of the error is to go to
DATA0003 and select the users and refresh the list.
Then, their is no problem.
But, I would like to not have to go refresh user
everytime I add a login.
I would appreciate any help.
Thanks in advance,
BobEM uses SQLDMO and caches a lot of the information you see. In general this
is a good thing. I don't believe there is any way to alter the behaviour in
Enterprise Manager. See this note from BOL about SQLDMO collections
"To enable more efficient processing, SQL-DMO caches much of the information
about SQL Server components referenced by objects maintained in a
collection. When component data is cached, administrative activity of
another SQL Server session is not visible to the SQL-DMO session. The
Refresh method queries the organization server, filling the collection with
the most up-to-date component information."
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Bob Haines" <bhaines@.pahousegop.com> wrote in message
news:164f901c4173c$4c0e51e0$a501280a@.phx
.gbl...
> I run this code:
> EXEC DATA0003.dbo.sp_addlogin 'test','pwd'
> EXEC DATA0003.dbo.sp_grantdbaccess 'test'
> EXEC DATA0003.dbo.sp_addrolemember 'Full','test'
> When I go into enterprise and go to the properties of
> login and to Data Access Tab and select the Data0003
> (which is checked) I get this error:
> Error 21776:[SQL-DMO]The name 'test' was not found in the
> Users collection. If the name is a qualified name, use
> [] to separte various parts of the name, and try again.
> The only way I found to get rid of the error is to go to
> DATA0003 and select the users and refresh the list.
> Then, their is no problem.
> But, I would like to not have to go refresh user
> everytime I add a login.
> I would appreciate any help.
> Thanks in advance,
> Bob|||try this
type:
use DATA0003
before :
EXEC DATA0003.dbo.sp_addlogin 'test','pwd'
EXEC DATA0003.dbo.sp_grantdbaccess 'test'
EXEC DATA0003.dbo.sp_addrolemember 'Full','test'
and execute it. this may solve the problem
quote:
Originally posted by Jasper Smith
EM uses SQLDMO and caches a lot of the information you see. In general this
is a good thing. I don't believe there is any way to alter the behaviour in
Enterprise Manager. See this note from BOL about SQLDMO collections
"To enable more efficient processing, SQL-DMO caches much of the information
about SQL Server components referenced by objects maintained in a
collection. When component data is cached, administrative activity of
another SQL Server session is not visible to the SQL-DMO session. The
Refresh method queries the organization server, filling the collection with
the most up-to-date component information."
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Bob Haines" <bhaines@.pahousegop.com> wrote in message
news:164f901c4173c$4c0e51e0$a501280a@.phx
.gbl...
> I run this code:
> EXEC DATA0003.dbo.sp_addlogin 'test','pwd'
> EXEC DATA0003.dbo.sp_grantdbaccess 'test'
> EXEC DATA0003.dbo.sp_addrolemember 'Full','test'
> When I go into enterprise and go to the properties of
> login and to Data Access Tab and select the Data0003
> (which is checked) I get this error:
> Error 21776:[SQL-DMO]The name 'test' was not found in the
> Users collection. If the name is a qualified name, use
> [] to separte various parts of the name, and try again.
> The only way I found to get rid of the error is to go to
> DATA0003 and select the users and refresh the list.
> Then, their is no problem.
> But, I would like to not have to go refresh user
> everytime I add a login.
> I would appreciate any help.
> Thanks in advance,
> Bob

No comments:

Post a Comment