473,320 Members | 1,940 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,320 software developers and data experts.

User changing own password via vb.net

60
i want the users themselves to be able to change their own respective password, is that possible without logging in as administrator or root account?
Apr 11 '07 #1
2 4536
Bungle
1
Not sure if you have an answer yet or not, but I this seems to work ok although probably not the best or most elegant solution .....


Public Sub changeUserPwd(ByVal userName As String, ByVal newPwd As String)
Dim conn As MySqlConnection
Dim connStr As String
connStr = String.Format("server={0};user id={1}; password={2}; database=WBA; pooling=false", _
"localhost", "root", "admin password goes here")

conn = New MySqlConnection(connStr)

Dim myCommand As New MySqlCommand
Dim myReader As MySqlDataReader

Dim SQL As String = "SET PASSWORD FOR ?UserName = PASSWORD(?myPwd);"

Try
Windows.Forms.Cursor.Current = Cursors.WaitCursor
conn.Open()
Try
With myCommand
.Connection = conn
.CommandText = SQL
.Parameters.AddWithValue("?UserName", Trim(userName.ToString))
.Parameters.AddWithValue("?myPwd", Trim(newPwd.ToString))
.ExecuteScalar() ' update
End With
myReader = myCommand.ExecuteReader

Catch ex As MySqlException
MsgBox(ex.Number & Chr(13) & ex.Message)
End Try

Catch ex As Exception
MsgBox(ex.Message)
Finally
closeSQLConnection(conn)
End Try
End Sub


I would not suggest hard coding the ip address or root password into the connection string but rather pass into the the sub as with the username & password. Hope this is of help. Bungle.
Apr 22 '07 #2
alan75
60
what i need is if i logged in as a user, i would like to change my own password, without admin or root account to change for me.
May 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: eastcoastguyz | last post by:
On an Apache server, I want to be able to have a user name/password directory. I know this can be done with .htaccess, but I want to be able to do this for multiple users. The purpose of this, is...
1
by: Vikrant | last post by:
(1) Under AIX for user 'db2xy1' of DB2/UDB 7.2EE , can I change password (for user db2xy1) by smitty at any time ?, or I have to do db2stop before changing user db2xy1 password by smitty? (2) To...
5
by: Markus Stehle | last post by:
Hi all! I have asp.net web application that uses static impersonation. Is it possible to change the impersonated user during runtime? Within some parts of my application I would like to...
4
by: - Steve - | last post by:
I'm trying to change a user's password using objUser.Invoke("setPassword", "newpassword") It works fine as a console application if I'm logged in with someone with the correct permissions. If...
11
by: ASP.NET User | last post by:
Hi I am in a shop where developers are required to work off of a networ share. This is so that code and other documentation is backed up nightly. This is outside the realm of Visual SourceSafe...
1
by: John French | last post by:
I just installed postgresql 7.4.5 and pgadmin3 1.0.2 on FreeBSD and noticed that pgadmin allows the pgsql user to log in while ignoring the password. You can enter a wrong password or no password...
4
by: Terry Miller | last post by:
I have DB2 V8.2 loaded on a Redhat Enterprise Linux version 3 (RHEL 3) box. RHEL is configured to talk to LDAP for authenticaton besides the local passwd file. I can verify this by executing an su...
12
by: Michael | last post by:
Please Help me. I've got a .Net 2003 program that attaches to a SQL Server machine and I'm getting the above error when a user tries to log in. The SQL server is setup to use Windows Auth. and I...
1
by: =?Utf-8?B?Qi5BaGxzdGVkdA==?= | last post by:
Hi all, This is something that I have been toying with for about a week now. What I want to achieve is Install a Service with Customised parameters (using InstallUtil.exe) for User Name. Example...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.