我正在使用IdeaBlade 3.6版。我注意到以下生成的SQL更新查询:
(@ P1 nchar(32),@ P2 nvarchar(32),@ P3 nvarchar(512),@ P4 nchar(32),@ P5 int,@ P6 nvarchar(32),@ P7 int,@ P8 datetime ,@ P9 datetime,@ P10 datetime,@ P11 int,@ P12 datetime,@ P13 int,@ P14 int,@ P15 int,@ P16 nvarchar(32),@ P17 nvarchar(128),@ P18 nvarchar(32), @ P19 nvarchar(32),@ P20 datetime,@ P21 datetime,@ P22 bit,@ P23 nvarchar(32),@ P24 nvarchar(64),@ P25 nchar(32))更新“dbo”。“GSS_Documents”set“ DocumentID “= @ P1,” 文件名 “= @ P2,” 文件路径 “= @ P3,” BusinessOfficeID “= @ P4,” 页数 “= @ P5,” 文件大小 “= @ P6,” DocumentType “= @ P7,” dateCreated会“= @ P8,” EffectiveDateCreated “= @ P9” DateProcessed “= @ P10,” ProcessorID “= @ P11,” DateReviewed “= @ P12,” ReviewerID “= @ P13,” WorkflowStatus “= @ P14,” 审批状态” = @ P15, “账户号码”= @ P16, “帐户名”= @ P17 “的SerialNumber”= @ P18,值 “TransactionID”= @ P19, “CriticalDate”= @ P20, “EmergencyDate”= @ P21, “GenerateSMSAlert”= @ P22,“CustomerPhoneNumber”= @ P23,“CustomerEmailAddress”= @ P24,其中“DocumentID”= @ P25
问题是DocumentID是主键。此更新似乎也在更新主键!关于如何制止这个的任何想法?
答案 0 :(得分:1)
您在此示例中使用的是Entity Framework,我们不会告诉EF如何完成其工作。也许你正在改变PK(我很怀疑)。直接跟进我们......尤其是关于依赖于EF v.4的DevForce 2010。