using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; using System.Configuration; using System.Data; using System.Web.Security; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; public partial class Admin_Changepaswword : System.Web.UI.Page { string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; string str = null; SqlCommand com; byte up; protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(strConnString); con.Open(); str = "select * from registration "; com = new SqlCommand(str, con); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { if (txtcnfpass.Text == reader["password"].ToString()) { up = 0; } } reader.Close(); con.Close(); if (up == 0) { con.Open(); str = "update login set password="+txtnewpass.Text+" where id='1'"; com = new SqlCommand(str, con); com.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50)); com.Parameters["@Password"].Value = txtnewpass.Text; // com.ExecuteNonQuery(); con.Close(); Label1.Text = "Password changed Successfully"; } else { Label1.Text = "Please enter correct Current password"; } } }
con.Open(); str = "update login set password="+txtnewpass.Text+" where id='1'"; com = new SqlCommand(str, con); //com.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50)); //com.Parameters["@Password"].Value = txtnewpass.Text; com.ExecuteNonQuery(); con.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)