我的类是这样写的
/// <summary>
    /// 管理员登录
    /// </summary>
    /// <param name="AdminName">管理员名字</param>
    /// <param name="AdminPwd">管理员密码</param>
    /// <param name="Reint">登录状态信息</param>
    /// <returns>返回信息:0:登录成功,-1:用户不存在,-2:密码不正确</returns>
    public DataSet UserLogin(String AdminName, String AdminPwd,ref Int32 Reint)
    {
        String Pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(AdminPwd, "MD5");
        DataSet ReDataSet;
        try
        {
            Con.Open();
            SqlStr = "SELECT * FROM Admin WHERE Admin_Name=" + AdminName;
            SqlDataAdapter Sda = new SqlDataAdapter();
            Sda.SelectCommand = new SqlCommand(SqlStr,Con);
            ReDataSet = new DataSet();
            Sda.Fill(ReDataSet,"AdminList");
            if (ReDataSet.Tables[0].Rows.Count > 0)
            {
                if (ReDataSet.Tables[0].Rows[0]["Admin_Password"].ToString() == Pass)
                {
                    Reint = 0;
                }
                else
                {
                    Reint = -2;
                }
            }
            else
            {
                Reint = -1;
            }
        }
        catch(Exception Ex)
        {
            throw new Exception("出错原因:" + Ex.Message);
        }
        return ReDataSet;
    }
然后我是这样调用的:
UserOperate UO = new UserOperate();
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "管理员登录~~!";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Int32 Int;
        DataSet DS = new DataSet();
        DS = UO.UserLogin(this.TextBox1.Text.Trim(),this.TextBox2.Text.Trim(), Int);
        switch (Int)
        {
            case 0:
                Response.Redirect("Default.aspx");
            case -1:
                this.Label1.Visible = true;
                this.Label1.Text="该用户不存在!";
            case -2:
                this.Label1.Visible=true;
                this.Label1.Text="您的密码不正确!";
        }
    }
但是出现了这样的错误,还请大家给与指正?
参数“3”必须与关键字“ref”一起传递
谢谢了先~!
[此贴子已经被作者于2007-10-20 13:59:40编辑过]



 
											






 
	    

 
	
