Changing SQL Server 2000 Password

J

Jim in Arizona

I'm using VS2005/2.0 Framework.

The SQL Server I was working with is MS SQL 2000. I don't know what
build off hand.

I tried to make a small web form to change the password, using this code:

Dim strCTID As String = txtClaimTrakID.Text
Dim strPassword As String = txtCurrentPassword.Text
Dim strNewPassword As String = txtNewPassword.Text
Dim strNewPassword2 As String = txtNewPassword2.Text

Dim strConnection As String
strConnection = "server=sql;database=master;integrated " & _
"security=false;uid=" & strCTID & ";pwd=" &
strPassword

Try
If strNewPassword = strNewPassword2 Then
SqlConnection.ChangePassword(strConnection, strNewPassword)
Else
Response.Write("New Passwords Did Not Match")
End If
Catch ex As Exception
Response.Write(ex.ToString)
End Try

The error I got back was this:

System.InvalidOperationException: ChangePassword requires SQL Server 9.0
or later. at System.Data.SqlClient.SqlConnection.ChangePassword(String
connectionString, String newPassword) at
tests_sqlpasswordchange.btnConnect_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\tests\sqlpasswordchange.aspx.vb:line 22

So, my question is, is there some other method I can use to get the job
done in this manner?

TIA,
Jim
 
G

Gaurav Vaish \(www.EdujiniOnline.com\)

If strNewPassword = strNewPassword2 Then
SqlConnection.ChangePassword(strConnection,
strNewPassword)
Else

System.InvalidOperationException: ChangePassword requires SQL Server 9.0
or later. at System.Data.SqlClient.SqlConnection.ChangePassword(String
So, my question is, is there some other method I can use to get the job
done in this manner?


Yes.
1. Connect to the database as database owner (or somebody with enough
permissions). Get into database master.
2. Execute stored procedure sp_password. Example:

exec sp_password 'old_Pass', 'new_Pass', 'user_name'

Do a Google Search for "sp_password".. it's a T-SQL command.


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com
-----------------------------------------
 
J

Jim in Arizona

Gaurav said:
Yes.
1. Connect to the database as database owner (or somebody with enough
permissions). Get into database master.
2. Execute stored procedure sp_password. Example:

exec sp_password 'old_Pass', 'new_Pass', 'user_name'

Do a Google Search for "sp_password".. it's a T-SQL command.
Ah. Ok. I didn't even think of going that route.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top