TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Azm Amn
NA
108
18k
Change password in Asp.Net
Mar 25 2017 8:23 AM
Hi,
I have many users in my system and i want all users to change their passwords respectively.
My code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
if (Label2.Text.Contains("@iumw.edu.my"))
{
if (TextBox1.Text == SqlDataSource1.SelectCommand)
{
if (TextBox2.Text == TextBox3.Text)
{
Label3.Visible = true;
Label3.Text = "";
con.Open();
SqlCommand cmd = new SqlCommand("Update [Programme Leader] set Password='" + TextBox3.Text + "'where Username='" + Session["username"].ToString() + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Label3.ForeColor = System.Drawing.Color.Red;
Label3.Text = "Password Changed Successfully";
}
}
}
if (Label2.Text != "")
{
if (TextBox1.Text == SqlDataSource2.SelectCommand)
{
if (TextBox2.Text == TextBox3.Text)
{
Label3.Visible = true;
Label3.Text = "";
con.Open();
SqlCommand cmd = new SqlCommand("Update Student set Password='" + TextBox3.Text + "'where Username='" + Session["username"].ToString() + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Label3.ForeColor = System.Drawing.Color.Red;
Label3.Text = "Password Changed Successfully";
}
}
}
if(TextBox2.Text != TextBox3.Text)
{
Label3.Visible=true;
Label3.Text = "";
Label3.ForeColor = System.Drawing.Color.Red;
Label3.Text = "The Passwords Do Not Match";
}
}
catch
{
}
}
}
}
I think i need a stored procedure to do this, but i dont know how to do it. please help me
Thanks
Reply
Answers (
1
)
Need guideline for dynamic software development.
giving user permission for edit data in other table