在一个按钮事件中有如下代码:
我打算把bean的对象作为参数传递给另一个方法.可当我把参数加到bean对象时报错.请问是什么原因?谢谢.
string popeNum = this.txtPopeNum.Text.Trim();
string name = this.txtName.Text.Trim();
string work = this.txtWork.Text.Trim();
string tell = this.txtTell.Text.Trim();
string note = this.txtNote.Text.Trim();
int checkDepName = ph.checkDepName("proc_searchDepName", name);
int checkpope = ph.checkSqlPope("proc_searchSqlName", popeNum); //下面这行代码有错误.提示:错误: "DepartmentBean”方法没有采用“5”个参数的重载 DepartmentBean dt = new DepartmentBean(name, work, tell, popeNum,note);
int result = ph.insertDep(dt);
我打算把bean的对象作为参数传递给另一个方法.可当我把参数加到bean对象时报错.请问是什么原因?谢谢.
string popeNum = this.txtPopeNum.Text.Trim();
string name = this.txtName.Text.Trim();
string work = this.txtWork.Text.Trim();
string tell = this.txtTell.Text.Trim();
string note = this.txtNote.Text.Trim();
int checkDepName = ph.checkDepName("proc_searchDepName", name);
int checkpope = ph.checkSqlPope("proc_searchSqlName", popeNum); //下面这行代码有错误.提示:错误: "DepartmentBean”方法没有采用“5”个参数的重载 DepartmentBean dt = new DepartmentBean(name, work, tell, popeNum,note);
int result = ph.insertDep(dt);
这个函数的参数个书不是个或者该函数的参数类型不匹配。
下面是bean的内容.
using System;
using System.Collections.Generic;
using System.Text;namespace Model
{
public class DepartmentBean
{
private string departmentName;
public string DepartmentName
{
get { return departmentName; }
set { departmentName = value; }
} private string departmentWork;
public string DepartmentWork
{
get { return departmentWork; }
set { departmentWork = value; }
} private string departmentTell;
public string DepartmentTell
{
get { return departmentTell; }
set { departmentTell = value; }
} private string departmentNote;
public string DepartmentNote
{
get { return departmentNote; }
set { departmentNote = value; }
} private string popeNum;
public string PopeNum
{
get { return popeNum; }
set { popeNum = value; }
}
}
}
这个函数的参数个数有问题。仔细检查下
DepartmentBean dt = new DepartmentBean();
dt.DepartmentName =name;
.......
是这样用的
构造函数传5个参数.