为什么我看到此错误:无法转换为'System.Boolean'类型。 [英] Why I am seeing this Error: cannot be converted to type 'System.Boolean'.
本文介绍了为什么我看到此错误:无法转换为'System.Boolean'类型。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Quote:
System.Int32类型的对象无法转换为System.Boolean类型。
Object of type 'System.Int32' cannot be converted to type 'System.Boolean'.
这是我的代码
this is my code
private void SetValues()
{
HR.Dal.Controllers.Leave_Request cLeaveReq = new HR.Dal.Controllers.Leave_Request();
try
{
HR.Dal.Model.Leave_Request iLeaveReq = cLeaveReq.Get(Convert.ToInt32(LeaveReqid));
txtLeaveReqId.Text = iLeaveReq.LEAVE_REQUEST_ID.ToString();
txtEmpNo.Text=iLeaveReq.EMP_NO;
txtFromDate.Text=iLeaveReq.FROM_DATE.ToString();
txtToDate.Text=iLeaveReq.TO_DATE.ToString();
RequestTypeId.Text=iLeaveReq.REQUEST_TYPE_ID.ToString();
txtApprovalDate.Text=iLeaveReq.APPROVAL_DATE.ToString();
txtIsApproved.Text=iLeaveReq.IS_APPROVED.ToString();
}
catch (Exception Exp)
{
throw Exp;
}
}
推荐答案
最有可能cLeaveReq.Get
方法接受一个布尔参数,你传递一个整数Convert.ToInt32(LeaveReqid)
。您需要更改方法或对方法的调用。
Most likelycLeaveReq.Get
method accepts a boolean parameter and you are passing it an integerConvert.ToInt32(LeaveReqid)
. You need to change either the method or the call to the method.
这篇关于为什么我看到此错误:无法转换为'System.Boolean'类型。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文