如何选择特定的实体对象进行更新?
我从数据库中的实体中提取所有对象
Dim dbConfig as New housingEntities
Dim update_query = (From p in dbConfig.Configs _
Select p)
然后,我想单独访问这些行并对它们执行更新...例如,如果我只需要第一行,我可以这样:
update_query.First.timeValue = txtFRRSD.Text
dbConfig.SubmitChanges()
现在,我不不知道如何编写此代码,但这是我想做的伪操作:
update_query.Item("FRRSD").timeValue = txtFRRSD.Text
update_query.Item("FRRCD").timeValue = txtFRRCD.Text
update_query.Item("SORSD").timeValue = txtSORSD.Text
update_query.Item("SORCD").timeValue = txtSORCD.Text
dbConfig.SubmitChanges()
有人知道一种方法可以做到这一点或类似的事情吗?
I'm pulling all the objects from an entity in my database
Dim dbConfig as New housingEntities
Dim update_query = (From p in dbConfig.Configs _
Select p)
Then, I want to individually access the rows and perform updates to them...For example, if I just needed the first row I could go like this:
update_query.First.timeValue = txtFRRSD.Text
dbConfig.SubmitChanges()
Now, I don't know how to code this, but here is pseudo what I'd like to do:
update_query.Item("FRRSD").timeValue = txtFRRSD.Text
update_query.Item("FRRCD").timeValue = txtFRRCD.Text
update_query.Item("SORSD").timeValue = txtSORSD.Text
update_query.Item("SORCD").timeValue = txtSORCD.Text
dbConfig.SubmitChanges()
Does anyone know a way to do this or something like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是一个用 C# 编写的通用示例,说明了如何一次更新多个实体对象。
}
Here is a generic example in C# of how I would update many entity objects at once.
}