Hi,
I've got a problem with new SQL Server 2005 T-SQL command alter login:
> alter login [LoginName] with password = 'NewPassword' works fine.
> exec sp_executesql N'alter login [LoginName] with password = @.P1', N'@.P1 nvarc
har(128)', N'NewPassword' does not work.
I get this error while executing an ADO 2.8 ADODB.Command with Parameters.
The .CommandText = "alter login [" & Login & "] with password = ?" seems
to
be executed as exec sp_executesql ... (see Profiler).
sp_password works fine, but BOL says not to use sp_password in new
applications.
Can anybody help, please?ALTER LOGIN doesn't accept variables so you can't parameterize the
statement. Is your intention to allow the current user to change their
password? In that case, you can specify the old/new password in the
connection string using the SQLNCLI provider:
"Provider=SQLNCLI;Data Source=MyServer;User ID=MyLogin;Old
Password=oldpassword;Password=newpasswor
d"
Hope this helps.
Dan Guzman
SQL Server MVP
"migeold" <migeold@.discussions.microsoft.com> wrote in message
news:418664FA-F9B0-4C82-8A17-A4D786C741B1@.microsoft.com...
> Hi,
> I've got a problem with new SQL Server 2005 T-SQL command alter login:
> I get this error while executing an ADO 2.8 ADODB.Command with Parameters.
> The .CommandText = "alter login [" & Login & "] with password = ?" see
ms
> to
> be executed as exec sp_executesql ... (see Profiler).
> sp_password works fine, but BOL says not to use sp_password in new
> applications.
> Can anybody help, please?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment