INSERT 语句与 FOREIGN KEY 约束“FK_UserCars_aspnet_Users”冲突
我正在尝试使用 ObjectDataSource 插入方法将数据插入到 UserCars 表中。 我尝试插入的 userId(FOREIGN KEY) 是 GUID 类型。
主键是 aspnet_users 表中的 UserId(uniqeidentifier)
,它是 Membrship 架构的一部分。
userId(guid) = JustCreateduser
所以这意味着它应该是相同的值。
I am trying to insert data to UserCars table using ObjectDataSource Insert Method.
the userId(FOREIGN KEY) I am trying to insert is GUID type.
The primary key is UserId(uniqeidentifier)
in aspnet_users table which is part of Membrship schema.
userId(guid) = JustCreateduser
so it means it should be the same values.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看它是否确实存在:
如果您无法获取有关实际发生情况的信息,请在 SQL Profiler 中进行跟踪,捕获 SQL 语句完成、SP 语句完成、RPC 调用完成和 RPC 输出参数(以防 GUID正在打电话回来)。
这应该会给您一些想法,以便能够继续解决问题。
See if it really does exist:
If you're having trouble getting info on what's actually happening, do a trace in SQL Profiler, capturing SQL statement completion, SP statement completion, RPC call completion, and RPC output parameter (just in case the GUID is coming back from a call).
That should give you some ideas to be able to proceed forward with solving the problem.
在将 guid 插入 UserCars 表之前,您是否确认该 guid 确实存在于 aspnet_users 表中?
Have you confirmed that the guid does actually exist in the aspnet_users table prior to inserting it into the UserCars table?