Y
ywan
Unregistered / Unconfirmed
GUEST, unregistred user!
各位好,
我自定义一个类如下(在Branch 单元中):
type
mBranch = class (TObject)
private
FbranchId: string;
FdeptId: string;
FdeptName: string;
FgroupName: string;
public
property branchId: string read FbranchId write FbranchId;
property deptId: string read FdeptId write FdeptId;
property deptName: string read FdeptName write FdeptName;
property groupName: string read FgroupName write FgroupName;
end;
然后我UBranch 单元另一个类中的一个函数引用这个类作为一个参数类型,如下:
type
TFrmBranch = class (TForm)
private
function SaveBranchRule(objmBranch:mBranch) :string;
end;
function TFrmBranch.SaveLogic(strDeptName:string;strGroupName:string):string;
var
objCommon:CommonFunc;
objmBranch: mBranch;
objBranchDb:BranchDb;
strBranchId:string;
strDeptId:string;
strRet:string;
//Query:TADOQuery;
begin
objCommon:=CommonFunc.Create;
if (strMode='ND') then
begin
objmBranch:= mBranch.Create;
strDeptId:=objCommon.GetNewNo('Organize','DeptId',3);
strBranchId:= strDeptId +'01';
objmBranch.branchId:= strBranchId;
objmBranch.deptId := strDeptId;
objmBranch.deptName :=strDeptName;
objmBranch.groupName :=strGroupName;
strRet:=SaveBranchRule(objmBranch);
end;
end;
但是执行到最后一行时出现“Invailid variant type”的错误。
请教各位该如何解决这个问题,谢谢!
我自定义一个类如下(在Branch 单元中):
type
mBranch = class (TObject)
private
FbranchId: string;
FdeptId: string;
FdeptName: string;
FgroupName: string;
public
property branchId: string read FbranchId write FbranchId;
property deptId: string read FdeptId write FdeptId;
property deptName: string read FdeptName write FdeptName;
property groupName: string read FgroupName write FgroupName;
end;
然后我UBranch 单元另一个类中的一个函数引用这个类作为一个参数类型,如下:
type
TFrmBranch = class (TForm)
private
function SaveBranchRule(objmBranch:mBranch) :string;
end;
function TFrmBranch.SaveLogic(strDeptName:string;strGroupName:string):string;
var
objCommon:CommonFunc;
objmBranch: mBranch;
objBranchDb:BranchDb;
strBranchId:string;
strDeptId:string;
strRet:string;
//Query:TADOQuery;
begin
objCommon:=CommonFunc.Create;
if (strMode='ND') then
begin
objmBranch:= mBranch.Create;
strDeptId:=objCommon.GetNewNo('Organize','DeptId',3);
strBranchId:= strDeptId +'01';
objmBranch.branchId:= strBranchId;
objmBranch.deptId := strDeptId;
objmBranch.deptName :=strDeptName;
objmBranch.groupName :=strGroupName;
strRet:=SaveBranchRule(objmBranch);
end;
end;
但是执行到最后一行时出现“Invailid variant type”的错误。
请教各位该如何解决这个问题,谢谢!