当我尝试使用上传文件上传图片文件时,会显示此错误
[DataConnection.HandleError]:查询:INSERT INTO CMS_Attachment ([AttachmentID],[AttachmentName],[AttachmentExtension], [AttachmentSize],[AttachmentMimeType],[AttachmentBinary], [AttachmentImageWidth],[AttachmentImageHeight], [AttachmentDocumentID],[AttachmentGUID],[AttachmentLastHistoryID], [AttachmentSiteID],[AttachmentLastModified],[AttachmentIsUnsorted], [AttachmentOrder],[AttachmentGroupGUID],[AttachmentFormGUID], [AttachmentHash],[AttachmentTitle],[AttachmentDescription], [AttachmentCustomData])VALUES(@AttachmentID,@ AttachmentName, @AttachmentExtension,@ AttachmentSize,@ AtatachmentMimeType, @AttachmentBinary,@ AttachmentImageWidth,@ AttachmentImageHeight, @AttachmentDocumentID,@ AttachmentGUID,@ AtatachmentLastHistoryID, @AttachmentSiteID,@ AttachmentLastModified,@ AttachmentIsUnsorted, @AttachmentOrder,@ AtatachmentGroupGUID,@ AttachmentFormGUID, @AttachmentHash,@ AttachmentTitle,@ AttachmentDescription, @AttachmentCustomData); SELECT SCOPE_IDENTITY()AS []:引起 exception:对象或列名称缺失或为空。对于SELECT INTO语句,验证每列是否有名称。对于其他陈述, 寻找空的别名。定义为“”或[]的别名不是 允许。将别名更改为有效名称。
它发生在每个包含上传文件对话框的页面中。我不知道这个错误。有什么帮助吗?
答案 0 :(得分:1)
好像你在某个方面遗漏了CMS_Attachment
表上的主键。尝试检查并可能添加。
ALTER TABLE [dbo].[CMS_Attachment] ADD CONSTRAINT [PK_CMS_Attachment] PRIMARY KEY NONCLUSTERED
(
[AttachmentID] ASC
)
不要忘记重新启动您的应用。