473,396 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Execute SP_password

I'm using Access 2000 and have tried Access 2003 front-end to execute
the stored procedure sp_password on SQL Server 2000. I continue to
receive the following message: "The old (current) password was not
correct. Password not changed." If I go into query analyzer and run
an execute @old, @new, @loginame with the same values as passed to my
command collection in Access, it works just fine. I'm using Windows
Authentication and my server is defined for SQL Server and Windows
authentication. I have tried using the sqladmin account and have
received the same error message. I have verified the old password and
I know it is correct because I am able to change the password by
executing the same stored procedure in query analyzer. Why are the
results different? How can I resolve this problem?
Jul 20 '05 #1
5 13949
ano1optimist (an**********@aol.com) writes:
I'm using Access 2000 and have tried Access 2003 front-end to execute
the stored procedure sp_password on SQL Server 2000. I continue to
receive the following message: "The old (current) password was not
correct. Password not changed." If I go into query analyzer and run
an execute @old, @new, @loginame with the same values as passed to my
command collection in Access, it works just fine. I'm using Windows
Authentication and my server is defined for SQL Server and Windows
authentication. I have tried using the sqladmin account and have
received the same error message. I have verified the old password and
I know it is correct because I am able to change the password by
executing the same stored procedure in query analyzer. Why are the
results different? How can I resolve this problem?


Obviously the call that is generated from Access, is not the same
that you make from Query Analyzer.

I would use the Profiler to see what is actually being sent to SQL
Server.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
In query analyzer, this is my statement:

execute master.dbo.sp_password 'OLD', 'NEW', 'XYZ'

In Access, here is my code:

Set Cmd = New ADODB.Command
Set Prm = New ADODB.Parameter
Set Cmd.ActiveConnection = CnnAdo
Cmd.CommandText = "master.dbo.sp_password"
Cmd.CommandType = adCmdStoredProc

Set Prm = Cmd.CreateParameter("@old", adVarChar, adParamInput, 10,
Me!txtoldpassword)
Cmd.Parameters.Append Prm

Set Prm = Cmd.CreateParameter("@new", adVarChar, adParamInput, 10,
Me!txtnewpassword)
Cmd.Parameters.Append Prm

Set Prm = Cmd.CreateParameter("@loginame", adVarChar, adParamInput,
10, Me!txtusername)
Cmd.Parameters.Append Prm

Cmd.Execute , dbFailOnError

I've added a message box prior to the cmd.execute statement and it
shows the following:

@OLD = OLD
@NEW = NEW
@LOGINAME = XYZ

If I try to execute the statement in Query Analyzer twice, the second
time, it shows the following, as is should on the second try:

Server: Msg 15211, Level 16, State 1, Procedure sp_password, Line 58
Old (current) password incorrect for user. The password was not
changed.

This is the message I get whenever I execute the access command code,
regardless of first or second try.

So, how could I be executing different code? Please explain further
because this has really stumped me.
Jul 20 '05 #3
I've tried running the Profiler to see what is happening but I've
never used that product before. The Loginames were the same, except
for case. I tried it again making sure that the loginnames were of
the same case and still got the same error message. Is this a timing
issue where the change hasn't been committed yet?
Jul 20 '05 #4
ano1optimist (an**********@aol.com) writes:
In query analyzer, this is my statement:

execute master.dbo.sp_password 'OLD', 'NEW', 'XYZ'

In Access, here is my code:
...
Server: Msg 15211, Level 16, State 1, Procedure sp_password, Line 58
Old (current) password incorrect for user. The password was not
changed.

This is the message I get whenever I execute the access command code,
regardless of first or second try.


I ran a variation of your code from Visual Basic:

oCommand.CommandType = adCmdStoredProc
oCommand.CommandText = "master.dbo.sp_password"
oCommand.Parameters.Append oCommand.CreateParameter( _
"@old", adVarChar, adParamInput, 10, "ggggg")
oCommand.Parameters.Append oCommand.CreateParameter( _
"@new", adVarChar, adParamInput, 10, "hhhhh")
oCommand.Parameters.Append oCommand.CreateParameter( _
"@login", adVarChar, adParamInput, 10, "lklklkl")
oCommand.Execute

And this worked the first time (but of course the second time). On the
first successful occassion there was no output, as it can be fairly
difficult to pick up messages that are not errors with ADO.

I'm a bit out of ideas, but one thing is to check is that you don't run
the Access code twice by mistake. And of course, that the old
password or login does not exceed 10 characters in length.

My suggestion to use the profiler was not entirely useful. Profiler
reconizes sp_password and sensors the parameter. You could could
however call a wrapper SP that calls sp_password and trace that
call.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5
I removed the dbFailOnError from the command execute line and changed
the code to use a wrapper stored procedure and everything works just
fine. I tried it again without the wrapper stored procedure and
continued to get the same old message about the old password not being
correct, even though I knew it was. Thanks for the info on the
Profiler, I'm fairly new to SQL Server so it will be a great help.
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
7
by: William Gill | last post by:
I have been trying to pass parameters as indicated in the api. when I use: sql= 'select * from %s where cusid = %s ' % name,recID) Cursor.execute(sql) it works fine, but when I try : sql=...
9
by: PyPK | last post by:
Hi if I have a function called tmp=0 def execute(): tmp = tmp+1 return tmp also I have def func1(): execute() ....
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
2
by: Norman Fritag | last post by:
Hi there The below code executes some queries. As newbie I was wondering weather you are better of using connection execute or command execute to execute queries? I am asking as...
2
by: Dune | last post by:
I'm trying to execute an aspx page by calling Server.Execute. The aspx page I'm trying to execute is in a different web app from the aspx page containing the Server.Execute statement. A slightly...
2
by: partybob99 | last post by:
I am trying to call SP_Password from some vb.net code. This should be very straight forward but no matter what I do, I keep getting errors. Here is the code strConnectString = "Data Source=" +...
0
by: Straw | last post by:
I found this script for modifying sp_password. My requirements are that the password must be at least 8 characters long and have a minimum of 1 numeric character in the 2nd through next-to-last...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.