我一直在尝试很多方法,但它不断给我下面的代码这个错误
using (custTrans db = new custTrans())
{
Guid AgentGUID = Guid.Parse(AgentUID);
var AgentQuery = from a in db.Agents
join u in db.UserLogins on a.UserUID equals u.UserUID into j
from u in j.DefaultIfEmpty()
where a.AgentUID == AgentGUID
select new { a.AgentUID , a.Name, u.Login, u.UserUID, u.Type };
foreach (var result in AgentQuery)
{
txtName.Text = result.Name;
txtUsername.Text = result.Name
}
}
当我尝试加载记录时,我不断收到此错误
转换为值类型“Guid”失败,因为具体化值为 null。结果类型的泛型参数或查询必须使用可为空的类型。
任何人都知道如何解决这个问题?