C# 从SQL行到GUID的指定强制转换无效
我在网上尝试了一切,并尝试将其转换为字符串,然后再转换为Guid,但我一直遇到这个错误C# 从SQL行到GUID的指定强制转换无效,c#,dynamics-crm-2011,dynamics-crm,C#,Dynamics Crm 2011,Dynamics Crm,我在网上尝试了一切,并尝试将其转换为字符串,然后再转换为Guid,但我一直遇到这个错误 if ((DateTime)objRow["ExamDate"] > dDateGranted) { dDateGranted = (DateTime)objRow["ExamDate"]; } if (objRow["ExamId"].
if ((DateTime)objRow["ExamDate"] > dDateGranted)
{
dDateGranted = (DateTime)objRow["ExamDate"];
}
if (objRow["ExamId"].ToString().ToLower() != SPIExamID.ToString().ToLower())
{
ColumnSet cols = new ColumnSet("new_beenprocessed");
var examID = objRow["ExamResultId"];
oExamResult = (New_ExamResult)objService.Retrieve("new_examresult", (Guid)examID, cols);
oExamResult.New_BeenProcessed = true;
objService.Update(oExamResult);
}
当我调试时,它的值是“87F5E8FB-8105-E611-9E7C-00155DF30E9B”,因此我知道它是一个GUID,但CrmOrganizationServiceContext不会将其识别为GUID。如果我尝试使用新Guid(examID),它会说它无法将对象转换为字节
任何帮助都将不胜感激试试看
var examID = new Guid(objRow["ExamResultId"].ToString());