以下是页面的代码 <form id="form1" runat="server">
<table border="0" cellpadding="8" cellspacing="1" style=" margin:100px 0 0 200px; width:400px; color:#666; background:#ccc;">
<tr>
<td colspan="2" style="background:#5D7B9D; height: 14px; text-align:center; font-size:12px; color:#fff; padding:4px 0; font-weight:bolder;">修改个人密码</td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">原密码</td>
<td style="height: 14px;background: #fff;"><asp:TextBox runat="server" ID="emp_oldpsw" Width="120px" OnTextChanged="check_psw()"></asp:TextBox><asp:Label ID="hope_emp_name_info" runat="server"></asp:Label><span class="warnInfo">*</span></td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">新密码</td>
<td style="height: 14px; background: #fff;"><asp:TextBox runat="server" ID="emp_password" Width="120px"></asp:TextBox><span class="warnInfo">*</span></td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">重复输入</td>
<td style="height: 14px; background:#fff;"><asp:TextBox runat="server" ID="emp_repassword" Width="120px"></asp:TextBox><span
class="warnInfo">*</span></td>
</tr>
<tr>
<td colspan="2" style="background:#E9ECF1; height: 14px; text-align:center; font-size:12px; color:#fff; padding:4px 0; font-weight:bolder;"><asp:Button Text="确认修改" ID="submit" runat="server" /></td>
</tr>
</table>
</form>
以下是程序的代码 public void check_psw(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=110.136.48.24;Initial Catalog=hope_loan;Integrated Security=True");
conn.Open();
String sql = "select hope_emp_name,hope_emp_pswd from [hope_empinfo] where hope_emp_name='" + Session["hope_user_name"] + "' and hope_emp_pswd='" + emp_oldpsw.Text + "'";
SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
int iRows = ds.Tables[0].Rows.Count;
if (iRows == 0)
{
hope_emp_name_info.Visible = true;
hope_emp_name_info.Text = "输入密码错误";
}
}
以下是报错信息:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0103: 当前上下文中不存在名称“emp_oldpsw”源错误: 行 21: SqlConnection conn = new SqlConnection("Data Source=110.136.48.24;Initial Catalog=hope_loan;Integrated Security=True");
行 22: conn.Open();
行 23: String sql = "select hope_emp_name,hope_emp_pswd from [hope_empinfo] where hope_emp_name='" + Session["hope_user_name"] + "' and hope_emp_pswd='" + emp_oldpsw.Text + "'";
行 24: SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
行 25: DataSet ds = new DataSet();
源文件: d:\asp.net\loan\Manage\emp_mdy_psw.aspx.cs 行: 23
//////////////////////////////////////////////////////////////////////麻烦高手看下啊!
<table border="0" cellpadding="8" cellspacing="1" style=" margin:100px 0 0 200px; width:400px; color:#666; background:#ccc;">
<tr>
<td colspan="2" style="background:#5D7B9D; height: 14px; text-align:center; font-size:12px; color:#fff; padding:4px 0; font-weight:bolder;">修改个人密码</td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">原密码</td>
<td style="height: 14px;background: #fff;"><asp:TextBox runat="server" ID="emp_oldpsw" Width="120px" OnTextChanged="check_psw()"></asp:TextBox><asp:Label ID="hope_emp_name_info" runat="server"></asp:Label><span class="warnInfo">*</span></td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">新密码</td>
<td style="height: 14px; background: #fff;"><asp:TextBox runat="server" ID="emp_password" Width="120px"></asp:TextBox><span class="warnInfo">*</span></td>
</tr>
<tr>
<td style=" text-align: right; height: 14px;color:#333333;background-color:#E9ECF1;">重复输入</td>
<td style="height: 14px; background:#fff;"><asp:TextBox runat="server" ID="emp_repassword" Width="120px"></asp:TextBox><span
class="warnInfo">*</span></td>
</tr>
<tr>
<td colspan="2" style="background:#E9ECF1; height: 14px; text-align:center; font-size:12px; color:#fff; padding:4px 0; font-weight:bolder;"><asp:Button Text="确认修改" ID="submit" runat="server" /></td>
</tr>
</table>
</form>
以下是程序的代码 public void check_psw(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=110.136.48.24;Initial Catalog=hope_loan;Integrated Security=True");
conn.Open();
String sql = "select hope_emp_name,hope_emp_pswd from [hope_empinfo] where hope_emp_name='" + Session["hope_user_name"] + "' and hope_emp_pswd='" + emp_oldpsw.Text + "'";
SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
int iRows = ds.Tables[0].Rows.Count;
if (iRows == 0)
{
hope_emp_name_info.Visible = true;
hope_emp_name_info.Text = "输入密码错误";
}
}
以下是报错信息:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0103: 当前上下文中不存在名称“emp_oldpsw”源错误: 行 21: SqlConnection conn = new SqlConnection("Data Source=110.136.48.24;Initial Catalog=hope_loan;Integrated Security=True");
行 22: conn.Open();
行 23: String sql = "select hope_emp_name,hope_emp_pswd from [hope_empinfo] where hope_emp_name='" + Session["hope_user_name"] + "' and hope_emp_pswd='" + emp_oldpsw.Text + "'";
行 24: SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
行 25: DataSet ds = new DataSet();
源文件: d:\asp.net\loan\Manage\emp_mdy_psw.aspx.cs 行: 23
//////////////////////////////////////////////////////////////////////麻烦高手看下啊!
解决方案 »
- 一个枚举参数传递的问题
- protected internal怎么无效吗?
- 数据库登录失败
- 帮偶看看asp.net显示表格滴问题哈!-_-!
- asp.net WebApplication Bin目录下的pdb文件用来做啥的?
- 用Jmail发送邮件出现这样的错误,那里大哥能帮忙一下吗?
- 请教,关于保留Datagrid中的checkbox的值
- 调试问题,在线急等,大侠们帮忙解决呀,要不回不了家了!!!
- 怎么写接口
- bootsrap怎样动态绑定树形下拉列表,实现功能:图片可选中不同部门的人(一级列表和二级列表都是从数据库读取的 ,可选中一人也可多选(结贴赠分)) 图片如下图
- 求一采集新闻内容正则表达式
- .NET层与层切换通过哪个空间实现效果更好,提供一些好的建议和方法
Response.Write(sql);Response.End();
将输出的sql语句放到查询分析器里执行
提示是
编译器错误信息: CS1501: “check_psw”方法没有采用“0”个参数的重载
改为
OnTextChanged="check_psw"
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="check_psw"></asp:TextBox>.cs
protected void check_psw(object sender, EventArgs e)
{ }
protected void check_psw(object sender, EventArgs e)
{}
这样就出来了,我试过了,界面还可以