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
ta mu
NA
201
82.2k
change password
Aug 6 2013 4:11 AM
i am using this code for changing password when i enter correct password its ok password is updated. but when i enter wrong password no error messag is shown whats wrong with code
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = (@"Data Source=heaven_prince20;Initial Catalog=final_pr;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT password FROM login WHERE Password='" +Convert.ToInt32( textBox1.Text )+ "'", con);
cmd.ExecuteNonQuery();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if ((Convert.ToInt32( (dr["password"])) !=Convert.ToInt32( ( textBox1.Text))||Convert.ToInt32( textBox2.Text)!=Convert.ToInt32( textBox3.Text)))
{
MessageBox.Show("old password is worng");
}
else
{
dr.Close();
SqlCommand cmd1 = new SqlCommand("UPDATE login SET password='" + Convert.ToInt32(textBox2.Text) + "' WHERE password='" + textBox1.Text + "'", con);
cmd1.ExecuteNonQuery();
MessageBox.Show("Record Update Successfully");
}
Reply
Answers (
4
)
How to Export DataGridview Data in Excel format in C#.Net
GRID EDIT