ModifyInfo.aspx.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data; public partial class ModifyInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
//修改界面,修改变更请求
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
e.Cancel = true;//取消修改事件发到系统框架
//获得输入信息,并组成SQL语句
string bgqq = ((TextBox)FormView1.FindControl("stdBgqqTextBox")).Text;
string stdXh = Session["stdXh"].ToString();
string sql = "update stdInfo set stdBgqq=@bgqq where stdXh=@stdXh";
SqlParameter[] param ={
new SqlParameter("@bgqq",SqlDbType.Text),
new SqlParameter("@stdXh",SqlDbType.Char)
};
param[].Value = bgqq;
param[].Value = stdXh;
//执行SQL语句,修改数据库
sqlHelp.ExecuteNoneQuery(sqlHelp.ConnectionStringLcalTransaction, CommandType.Text, sql, param);
//重新加载本页面,刷新数据
Response.Redirect("ModifyInfo.aspx?stdXh=" + stdXh);
}
//修改密码按钮处理事件
protected void LinkButton1_Click(object sender, EventArgs e)
{
//获得输入的新旧密码和登陆时保存的用户名
string oldPassword = txtOldPassword.Text.Replace("'", "");
string newPassword = txtNewPassword.Text.Replace("'", "");
string stdXh = Session["stdXh"].ToString();
//查询数据库 验证旧密码是否正确
string sql =
"select count(*) from stdInfo where stdXh=@stdXh and stdMm=@stdMm";
SqlParameter []param={
new SqlParameter("@stdXh",SqlDbType.Text),
new SqlParameter("@stdMm",SqlDbType.Text)
};
param[].Value=stdXh;
param[].Value=oldPassword;
int usercount=((int )(sqlHelp.ExecuteScalar(sqlHelp.ConnectionStringLcalTransaction,CommandType.Text,sql,param)));
if(usercount<=)//如果查询不到记录,表示旧密码错误
{
labMsg.Text = "旧密码错误";
}
else{
//执行数据库操作修改密码
string updatesql=
"update stdInfo set stdMm=@stdMm where stdXh=@stdxh";
SqlParameter []updateParam={
new SqlParameter("@stdXh",SqlDbType.Text),
new SqlParameter("@stdMm",SqlDbType.Text)
};
param[].Value=stdXh;
param[].Value=newPassword;
if(sqlHelp.ExecuteNoneQuery(sqlHelp.ConnectionStringLcalTransaction,CommandType.Text,updatesql,updateParam)>)
{
labMsg.Text="修改成功";
}
else
{
labMsg.Text="修改失败";
}
}
}
}
ModifyInfo.aspx.cs代码的更多相关文章
- asp微信支付代码证书文件post_url.aspx和post_url.aspx.cs源码下载
很多朋友在网上找的asp支付代码中都没有这两个证书文件,只能是用别人的,但是如果别人把他的网站这个文件删了,你的支付也就不能用了,今天我就把大家需要的这两个asp微信支付代码证书文件post_url. ...
- 在VS中建立.aspx,.cs,.designer.cs之间的级联关系
<Compile Include="..\Admin\Actions.aspx.cs"> <DependentUpon>Actions.aspx</D ...
- 【转】aspx与aspx.cs的关系
原文地址: http://www.cnblogs.com/axzxs2001/archive/2009/01/19/1378383.html 在vs中,有很多朋友问起,在一个网站项目中的aspx和as ...
- WebForm.aspx 页面通过 AJAX 访问WebForm.aspx.cs类中的方法,获取数据
WebForm.aspx 页面通过 AJAX 访问WebForm.aspx.cs类中的方法,获取数据 WebForm1.aspx 页面 (原生AJAX请求,写法一) <%@ Page Langu ...
- jQuery Ajax 方法调用 Asp.Net WebService 以及调用aspx.cs中方法的详细例子
一.jQuery Ajax 方法调用 Asp.Net WebService (引自Terry Feng) Html文件 <!DOCTYPE html PUBLIC "-//W3C//D ...
- aspx文件、aspx.cs文件、aspx.designer.cs文件之讲解
.aspx文件:(页面)书写页面代码.存储的是页面design代码.只是放各个控件的代码,处理代码一般放在.cs文件中. .aspx.cs文件:(代码隐藏页)书写类代码.存储的是程序代码.一般存放与数 ...
- 后缀.aspx.cs是什么软件的生成的
ASP.NET技术 aspx ——ASP.NET文件(网页) aspx.cs ——ASP.NET文件中的代码页(与上面的对应) asp.net是微软公司推出的新一代网站程序开发架构,ASP.NET技术 ...
- ASHX呼叫ASPX.cs的方法
ASHX呼叫ASPX.cs的方法 问题来自论坛,有网友这样的要求,在ASHX内呼叫ASPX.cs的一个方法或函数. 在一个网站中,也许不止只有一个aspx网页.把aspx.cs内的方法宣告为publi ...
- 用juery的ajax方法调用aspx.cs页面中的webmethod方法示例
juery的ajax调用aspx.cs页面中的webmethod方法:首先在 aspx.cs文件里建一个公开的静态方法,然后加上WebMethod属性,具体实现如下,感兴趣的朋友可以参考下哈,希望对大 ...
随机推荐
- Object学习笔记
<script type="text/javascript"> function forEach(o){ var html =""; for(var ...
- vmware, failed to lock the file
电脑死机,进不了桌面,实在不行就重启,但是在运行着虚拟机,重启后打开VMware虚拟机,提示failed to lock the file,进不去了,急阿,里面不少资料呢...问万能的Google,终 ...
- Android音频播放实例
MediaPlayer: 此类适合播放较大文件,此类文件应该存储在SD卡上,而不是在资源文件里,还有此类每次只能播放一个音频文件. 1.从资源文件中播放 MediaPlayer player = ne ...
- 粒子滤波particle filter和目标跟踪
粒子滤波用于跟踪,参考:http://www.cnblogs.com/tornadomeet/archive/2012/03/18/2404817.html http://blog.csdn.net/ ...
- 黑客讲述渗透Hacking Team全过程(详细解说)
近期,黑客Phineas Fisher在pastebin.com上讲述了入侵Hacking Team的过程,以下为其讲述的原文情况,文中附带有相关文档.工具及网站的链接,请在安全环境下进行打开,并合理 ...
- 解决android:theme="@android:style/Theme.NoDisplay" 加入这句话后程序不能运行
原因: 原来用的是ActionBarActivity,继承自 ActionBarActivity的类必须指定固定的集中Theme风格,而这些 Theme 风格是需要导入V7中的 appcompat L ...
- 【GoLang】GoLang 微服务、开源库等参考资料
参考资料: GoLang书籍: https://github.com/dariubs/GoBooksGo名库: https://github.com/Unknwon/go-rock-libraries ...
- VIM替换、截取及追加操作
参考: http://blog.csdn.net/love__coder/article/details/6739670 http://blog.csdn.net/love__coder/articl ...
- java Long的iniValue出错
Long l1 = 2500000000L; l1.intValue() 的值是负数 这里 System.out.println(Integer.MAX_VALUE); // 2147483647最大 ...
- Solr5.3.1 SolrJ查询索引结果
通过SolrJ获取Solr检索结果 1.通过SolrParams的方式提交查询参数 SolrClient solr = new HttpSolrClient("http://localhos ...