我有一个简单的 SQL UPDATE
查询,它提示“无效的对象名称”AuditCrudFields
,它根本不存在于我的 ASP.NET 项目中。 (我已经在我的项目中尝试过 grep 查找 AuditCrudFields
但找不到匹配项。)
UPDATE
语句是:
UPDATE [dbo].[PartModel]
SET partOfficial = 39, updateTS = CONVERT(DATETIME, ‘2017-12-08’, 111)
WHERE partId = 298
返回的错误:
令人费解的是,这些都是 PartModel
中存在的属性。所以我想知道 AuditCrudFields
来自哪里?
public class PartModel : EntityInformation
{
[Key]
public Int64 partId { get; set; }
public int partTypeId { get; set; }
[ForeignKey("partTypeId")]
public virtual PartTypeModel PartType { get; set; }
public int locationId { get; set; }
[ForeignKey("locationId")]
public virtual LocationModel Location { get; set; }
public int partOfficial { get; set; }
public int partUnofficial { get; set; }
public int partThreshold { get; set; }
public string partImg { get; set; }
public int partStatus { get; set; }
}
最佳答案
您可以运行此查询来定位尝试使用表 AuditCrudFields
的 SQL 对象代码:
select *
from sys.objects
where object_definition(object_id) like '%AuditCrudFields%'
如果这不在触发器定义内,我会感到非常惊讶。
关于c# - 这个无效的对象名称从何而来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47720474/