在default.aspx页面有以下的代码 
private void loginrecord()
    {
        Jxllt.DBUtility.DbHelperSQL.ConnDataBase("jxtmsg", "");
        SqlParameter[] list ={ new SqlParameter("@empid", SqlDbType.Int), new SqlParameter("@EmpCheckCode", SqlDbType.VarChar, 50), new SqlParameter("@Ret", SqlDbType.Int), new SqlParameter("@empRant",SqlDbType.Int) };
        list[0].Value =Convert.ToInt32(this.txtEmpid.Text);
        list[1].Value = Hid_code.Value.ToString();
        list[2].Direction = ParameterDirection.Output;
        list[3].Direction = ParameterDirection.Output;
        Jxllt.DBUtility.DbHelperSQL.ExecRunProce("Qf_LoginRecord", list);
    }  protected void Btnlogin_Click(object sender, EventArgs e)
    {
        
          if (txtEmpid.Text.Trim().ToString() == "")
        {
            Response.Write("用户名不能为空!请输入正确的用户名");
        }
        else
        {
            try
            {
                Jxllt.DBUtility.DbHelperSQL.ConnDataBase("jxtmsg", "");
                SqlParameter[] list ={
                               new SqlParameter("@Empid",SqlDbType.VarChar,12),
                               new  SqlParameter("@msgcontent",SqlDbType.VarChar,100),
                               new SqlParameter("@Ret",SqlDbType.Int)
                             };
                list[0].Value = this.txtEmpid.Text.Trim().ToString();
                list[1].Value = this.GenerateCheckCode();
                this.Hid_code.Value = list[1].Value.ToString();
                list[2].Direction = ParameterDirection.Output;
                Jxllt.DBUtility.DbHelperSQL.RunProcedure("Qf_Getcheckcode", list);
                Session["Empid"] = this.txtEmpid.Text;
                Session["checkcode"] = this.Hid_code.Value;
                this.loginrecord();
                Response.Write(list[2].Value);
                Response.Write("<script>alert('验证码获取成功,请注意查收!');</script>");
                Response.Redirect("Qf_login.aspx");
            }
            catch (System.NullReferenceException ee)
            {
                Response.Write(ee.Message);
            }
            
        }
    }
我现在想把 list[3].Direction = ParameterDirection.Output;值传到另外一个页面去,这个应该怎么传,session["EmpRant"]=list["3"].value.tostring();
但是我在调用这个session时候发现没有值这是怎么回事,正常情况下,他应该能返回1,2,或者3,请问这个该怎么解决

解决方案 »

  1.   

    楼主调试一下,看list["3"].value.tostring()有值吗?
      

  2.   

    当调用this.loginrecord(); 方法后就有值了
      

  3.   

    list["3"].value.tostring() 里面的3为什么要加引号?键值是3?
      

  4.   

    楼主,加断点跟踪值的变化吧,看是否把值存到session里了,注意看session[""]引号中的内容要一致,细心点肯定能发现
      

  5.   

    你给ession["EmpRant"]赋值的事件要确定里面的那个list["3"].value.tostring() 有值 你要写在那个this.loginrecord();  方法后面再赋值试试