473,902 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13973
ano1optimist (an**********@a ol.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_p assword 'OLD', 'NEW', 'XYZ'

In Access, here is my code:

Set Cmd = New ADODB.Command
Set Prm = New ADODB.Parameter
Set Cmd.ActiveConne ction = CnnAdo
Cmd.CommandText = "master.dbo.sp_ password"
Cmd.CommandType = adCmdStoredProc

Set Prm = Cmd.CreateParam eter("@old", adVarChar, adParamInput, 10,
Me!txtoldpasswo rd)
Cmd.Parameters. Append Prm

Set Prm = Cmd.CreateParam eter("@new", adVarChar, adParamInput, 10,
Me!txtnewpasswo rd)
Cmd.Parameters. Append Prm

Set Prm = Cmd.CreateParam eter("@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**********@a ol.com) writes:
In query analyzer, this is my statement:

execute master.dbo.sp_p assword '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.Comman dType = adCmdStoredProc
oCommand.Comman dText = "master.dbo.sp_ password"
oCommand.Parame ters.Append oCommand.Create Parameter( _
"@old", adVarChar, adParamInput, 10, "ggggg")
oCommand.Parame ters.Append oCommand.Create Parameter( _
"@new", adVarChar, adParamInput, 10, "hhhhh")
oCommand.Parame ters.Append oCommand.Create Parameter( _
"@login", adVarChar, adParamInput, 10, "lklklkl")
oCommand.Execut e

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
5070
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, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
7
8670
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= 'select * from %s where cusid like %s ' Cursor.execute(sql,(name,recID))
9
9599
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
12427
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 provided by Informix. This is the problem: the execution of the translated SQL leaves the rows in the temp table correctly but raises error SQL0480N. It's very simple to try it: ------------
2
7630
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 Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a Run-time error '-2147217900 (80040e14). If I execute the query from the query editor it's working ok!! No messages!!!
2
3345
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 clearer explanation... Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have put Server.Execute("Path to Page1 in WebApp1"). When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.aspx", everything works ok...
2
3813
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=" + strServer + ";Initial Catalog=master;user id=" + strID + ";password=" + strOldPass + ";" Conn.ConnectionString = strConnectString Conn.Open()
0
1240
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 position. I've got the 8 char long below. Can someone tell me how to do the minimum of 1 numeric character in the 2nd through next-to-last position? thanks! declare @position smallint, -- @numCaps...
9
4363
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). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
9845
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10870
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7205
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4725
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3323
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.