从实体框架执行行更新

发布于 2024-10-28 07:01:33 字数 499 浏览 1 评论 0原文

我想更新这样的行:

update [approvers] set approvalstatus = True Where approvalstatus = False and bookingID = @bookingid and approveremail = @email

使用实体框架。

我的查询应该像这样交付项目:

Dim db As New Model.Entities
Dim approvers = From a In db.approvers Where a.ApprovalStatus = False And a.BookingID = BookingID And a.ApproverEmail = UserName Select a.ApprovalStatus

下一步如何定位此记录进行更新,以便我可以设置 a.approvalStatus = True 然后将这些更改提交到数据库?

谢谢。

I would like to update a row like this:

update [approvers] set approvalstatus = True Where approvalstatus = False and bookingID = @bookingid and approveremail = @email

Using the entity framework.

I have my query which should deliver the item like so:

Dim db As New Model.Entities
Dim approvers = From a In db.approvers Where a.ApprovalStatus = False And a.BookingID = BookingID And a.ApproverEmail = UserName Select a.ApprovalStatus

How do I next target this record for update, so that I can set a.approvalStatus = True then commit these changes to the db?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

﹏半生如梦愿梦如真 2024-11-04 07:01:33
 Dim approver As Model.Approvers = (From a In db.Approvers Where a.ApprovalStatus = False And a.ApproverEmail = UserName And a.BookingID = BookingID).First

        approver.ApprovalStatus = True
        db.SaveChanges()
 Dim approver As Model.Approvers = (From a In db.Approvers Where a.ApprovalStatus = False And a.ApproverEmail = UserName And a.BookingID = BookingID).First

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