| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 517 人关注过本帖
标题:类方法的调用问题??
只看楼主 加入收藏
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
 问题点数:0 回复次数:2 
类方法的调用问题??

我的类是这样写的
/// <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编辑过]

2007-10-20 11:41
tel1982
Rank: 3Rank: 3
来 自:水星
等 级:新手上路
威 望:8
帖 子:852
专家分:0
注 册:2006-10-21
收藏
得分:0 

没有人懂吗?


Face up to life with smiles no matter what happens
2007-10-20 12:03
jxnuwy04
Rank: 2
等 级:新手上路
威 望:4
帖 子:768
专家分:0
注 册:2006-9-15
收藏
得分:0 

你的方法签名不是有一个关键字ref吗,你调用它的时候也要加上这个关键字啊.


------------------不为别的,就为你,我的理想!-----------------
2007-10-20 18:18
快速回复:类方法的调用问题??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.010966 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved