Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Updating Values entered by User in form to database
I am trying to create an application which involves the User to change the password.
I am using Microsoft Visual Studio for developing the Graphical User Interface and Microsoft SQL server as the back-end.
I have created a separate form which allows the user to change the password.
However I am unaware of how the particular password will be updated to the Database.
I have tried the following code for updating the new password to the database but it is not working.
There is no error in the code when compiling and running but the password is not updated in the database.
UserID = txtUserID.Text;
SqlCommand objSqlCommand = new SqlCommand("update NewUserRegister set Password = @Password
where UserID = @UserID
sql = objSqlCommand.Parameters.Add("@UserID", SqlDbType.Int);
sql.Value = UserID;
MessageBox.Show("Password Updated Successfully");
catch (SqlException e1)
MessageBox.Show(e1.Message, "Error Information", MessageBoxButtons.OK, MessageBoxIcon.Hand);
MessageBox.Show(e2.Message, "Error Information", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Can any one help me out with the correct code snippet I should use to update the password?
I am in urgent need of completing this task. Please reply me soon..
Thanks in advance!!