INSERT 语句与 FOREIGN KEY 约束“FK_UserCars_aspnet_Users”冲突

发布于 2024-08-20 16:06:29 字数 250 浏览 5 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陈年往事 2024-08-27 16:06:29

看看它是否确实存在:

SELECT * FROM aspnet_users WHERE UserIDGUID = @TheGuidBeingInserted

如果您无法获取有关实际发生情况的信息,请在 SQL Profiler 中进行跟踪,捕获 SQL 语句完成、SP 语句完成、RPC 调用完成和 RPC 输出参数(以防 GUID正在打电话回来)。

这应该会给您一些想法,以便能够继续解决问题。

See if it really does exist:

SELECT * FROM aspnet_users WHERE UserIDGUID = @TheGuidBeingInserted

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.

莫相离 2024-08-27 16:06:29

在将 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文