以下是页面的代码    <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 
//////////////////////////////////////////////////////////////////////麻烦高手看下啊!

解决方案 »

  1.   

    你用的vs2003吗?  要声明控件的vs2005应该是可以运行的。
      

  2.   

    string sql = "select hope_emp_name,hope_emp_pswd from [hope_empinfo] where hope_emp_name='" + Session["hope_user_name"].ToString() + "' and hope_emp_pswd='" + emp_oldpsw.Text + "'";
    Response.Write(sql);Response.End();
    将输出的sql语句放到查询分析器里执行
      

  3.   

    貌似是语法的错误啊
    提示是
    编译器错误信息: CS1501: “check_psw”方法没有采用“0”个参数的重载
      

  4.   

    OnTextChanged="check_psw()"
    改为
    OnTextChanged="check_psw"
      

  5.   

    html:
    <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="check_psw"></asp:TextBox>.cs
        protected void check_psw(object sender, EventArgs e)
        {    }
      

  6.   

    7楼抢先一步。。
     protected void check_psw(object sender, EventArgs e)
     {}
     这样就出来了,我试过了,界面还可以