【问题标题】:Specified Cast is invalid from SQL row to a GUID指定的转换从 SQL 行到 GUID 无效
【发布时间】:2016-06-16 15:50:44
【问题描述】:

我已经在线尝试了所有方法并尝试将其转换为字符串然后是 Guid,但我一直收到此错误。

                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。如果我尝试 new Guid(examID) 它说它不能将对象转换为字节。

任何帮助将不胜感激

【问题讨论】:

    标签: c# dynamics-crm-2011 dynamics-crm


    【解决方案1】:

    试试

    var examID = new Guid(objRow["ExamResultId"].ToString());
    

    【讨论】:

      猜你喜欢
      • 2012-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      相关资源
      最近更新 更多