本文介绍了如何纠正错误“无法将类型'int'隐式转换为'string'"?在'qual.employee_id =招聘.employee_id;中'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

隐藏复制代码

public class QualificationService
{
    public void SaveQualificationDetails(RecruitmentViewModel recruitment)
    {
        Qualification qual = new Qualification();
        qual.Employee_Id = recruitment.Employee_Id;
        qual.University = recruitment.University;
        qual.Highest_Qualification = recruitment.Highest_Qualification;
        qual.Specialization = recruitment.Specialization;
        qual.GradeResult = recruitment.GradeResult;
        qual.CV = recruitment.CV;
        qual.Application_Later = recruitment.Application_Later;
        qual.Recomendation_Later = recruitment.Recomendation_Later;

        using (HRMSEntities qualContext = new HRMSEntities())
        {
            qualContext.Qualification.Add(qual);
            qualContext.SaveChanges();
        }
    }
}

}

推荐答案

只需使用 Object.ToString():

qual.Employee_Id = recruitment.Employee_Id.ToString();

这篇关于如何纠正错误“无法将类型'int'隐式转换为'string'"?在'qual.employee_id =招聘.employee_id;中'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 10:31