March 10, 2009 at 9:55 am
Hi,
When I try to delete a login using smo, I have an error :
Drop failed for Login myLogin
This is what I do :
Dim log As New Login(myServer, myLogin)
If myServer.Logins.Contains(myLogin) Then
log.Drop()
End If
When I try to rename or change password for this Login, I obtain the same message.
Thanks
March 10, 2009 at 6:54 pm
I suspect that whatever connection you are using lacks the necessary permissions to administer logins. You could try to use trace/profiler to see what SMO is attempting to do in SQL Server.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 11, 2009 at 5:17 am
Thank you for your answer but I've found out!
I have to delete the schema and database users for the login first and replace Dim log As New Login(myServer, myLogin)
If myServer.Logins.Contains(myLogin) Then
Dim log As Login = myServer.Logins(myLogin)
If Not (log Is Nothing) Then log.Drop()
End If
March 11, 2009 at 9:53 am
Tasumy (3/11/2009)
Thank you for your answer but I've found out!I have to delete the shema and database users for the login first and replace
Dim log As New Login(myServer, myLogin)
If myServer.Logins.Contains(myLogin) Then
Dim log As Login = myServer.Logins(myLogin)
If Not (log Is Nothing) Then log.Drop()
End If
Well, that is true if you try to DROP the login, but that should not have any effect on changing the password?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 11, 2009 at 10:50 am
What do you mean "on changing the password"?
I don't need to change it.
March 11, 2009 at 11:46 am
From your original post:
Tasumy (3/10/2009)
When I try to rename or change password for this Login, I obtaine the same message.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 11, 2009 at 12:49 pm
Right. Sorry.
I'll try tomorrow.
Thanks
March 12, 2009 at 9:13 am
To change a password :
Dim log As Login = myServer.Logins(myLogin)
log.ChangePassword(myPwd)
instead of
Dim log As New Login(myServer, myLogin)
log.ChangePassword(myPwd)
Of course, the login has not to be "nothing".
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply