string Connstr;
string upConn;
string OldPassword=OldPsw.Text;
string NewPassword=NewPsw.Text;
if(OldPsw.Text=="")Label2.Text="请输入原始密码";
else if(NewPsw.Text=="")Label3.Text="请输入新密码";
else if(NewPsw.Text==ReNewPsw.Text)
{
SqlConnection myconnection=new SqlConnection(ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_uni"]);
myconnection.Open();
Connstr="SELECT usrName,LoginId,Password FROM [BaseInfo] Where usrName='"+Session["strUsername"]+"'";
SqlCommand mycommand=new SqlCommand(Connstr,myconnection);
SqlDataReader validate=mycommand.ExecuteReader();
if(validate.Read()&&OldPassword==validate.GetString(2))
{
validate.Close();
SqlConnection upconnection = new SqlConnection(ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_uni"]);
upconnection.Open();
upConn ="UPDATE [BaseInfo] SET Password='"+NewPsw.Text+"'";
SqlCommand upcommand = new SqlCommand(upConn,upconnection);
upcommand.ExecuteNonQuery();
upconnection.Close();
Label2.Text="修改成功!";
}
else Label4.Text="原始密码错误,请重新输入!";
validate.Close();
myconnection.Close();
}
else Label4.Text="新密码输入不一致,请重新输入!";
string upConn;
string OldPassword=OldPsw.Text;
string NewPassword=NewPsw.Text;
if(OldPsw.Text=="")Label2.Text="请输入原始密码";
else if(NewPsw.Text=="")Label3.Text="请输入新密码";
else if(NewPsw.Text==ReNewPsw.Text)
{
SqlConnection myconnection=new SqlConnection(ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_uni"]);
myconnection.Open();
Connstr="SELECT usrName,LoginId,Password FROM [BaseInfo] Where usrName='"+Session["strUsername"]+"'";
SqlCommand mycommand=new SqlCommand(Connstr,myconnection);
SqlDataReader validate=mycommand.ExecuteReader();
if(validate.Read()&&OldPassword==validate.GetString(2))
{
validate.Close();
SqlConnection upconnection = new SqlConnection(ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_uni"]);
upconnection.Open();
upConn ="UPDATE [BaseInfo] SET Password='"+NewPsw.Text+"'";
SqlCommand upcommand = new SqlCommand(upConn,upconnection);
upcommand.ExecuteNonQuery();
upconnection.Close();
Label2.Text="修改成功!";
}
else Label4.Text="原始密码错误,请重新输入!";
validate.Close();
myconnection.Close();
}
else Label4.Text="新密码输入不一致,请重新输入!";
解决方案 »
- 求救,实现的下载功能用迅雷下载时为什么老是下载的是那个页面????
- 将excel数据导入sql2005数据库
- asp.net怎么在aspx页面设置session过期啊?
- 时间限制系统的问题,法院审限系统,求高手指点
- GridView模板列中如何设置 dropdownlist 的失效属性?谢谢
- 实时时间、项目移植问题 一晚上没人帮我解决,急呀
- 各位大侠,如何将TextBox中的内容写入数据库呢?
- asp.net如何实现将一目录文件全部打包?
- [正则]<td align="left" valign="top" class="font14" id="Zoom">转义?
- asp.net
- 用户控件 一个事件执行问题。
- 需要在线编辑器
改为Connstr="SELECT usrName,LoginId,Password FROM [BaseInfo] Where usrName=\'"+Session["strUsername"]+"\'";
C#中单"'"为转义字符....应写为"\'".
换成
OldPassword.Equals(validate.GetString(2) ) 看看