主/子表 - 更新/删除错误 [英] Master/Child tables - update/delete error

查看:74
本文介绍了主/子表 - 更新/删除错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个主/子表。我已经通过bindingsource将它们绑定在表单上。它工作正常。我可以在两个表中添加新记录。但是当我尝试编辑/删除子记录时,在表单上完成,但是当尝试更新数据库时,它会给出错误更新需要有效的UpdateCommand,当传递带有修改行的DataRow集合时



有没有我们要设置的特殊更新命令?



请指导...

I have two Master/child tables. i have bounded them on form by bindingsource. it is working ok. i can add new record in both tables. But when i try to edit/delete child record, on the form, it is done but when try to update database, it gives error "Update requires a valid UpdateCommand when passed DataRow collection with modified rows"

is there any special Update command we have to set ?

Please guide ...

推荐答案

我得到了解决方案。实际上在我的Child表中,没有主键,因为dataadaptar属性中没有生成自动命令。我将主键设置为一个字段,然后再次重新配置,它已完成并正常工作。



ThX
i got the solution. Actually in my Child table, there was no primary key, due that auto command was not generated in dataadaptar property. I set primary key to a field then again reconfigure, it is done and working ok.

ThX


这篇关于主/子表 - 更新/删除错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆