[英]C# DATASET RELATIONS
I have two table我有两张桌子
Parent Table STUDENT ====> ID,NAME SqlCommand==>Select * from Student
Child Table Lessons ====> ID,STUDENTID,LESSON SqlCommand==>Select * from Lessons
I create DataRelation for two table with ID and StudentId我为两个具有 ID 和 StudentId 的表创建 DataRelation
I add 2 datagridview to my form.我在表单中添加了 2 个 datagridview。
First Table DataSource=Dataset.Relations[0].ParentTable;
第一个表DataSource=Dataset.Relations[0].ParentTable;
Second Table DataSource=Dataset.Relations[0].ChildTable;
第二个表DataSource=Dataset.Relations[0].ChildTable;
its not working like relational.How can I MAke child table StudentId defaultvalue parent table ID value它不像关系型那样工作。我怎样才能使子表 StudentId 默认值父表 ID 值
The second grid DataSource should be set to the DataSet.Relations[0] object.第二个网格数据源应设置为 DataSet.Relations[0] object。 In this case, everything will work properly.在这种情况下,一切都会正常工作。 Also, just found an MSDN article:另外,刚刚找到一篇 MSDN 文章:
Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls演练:使用两个 Windows Forms DataGridView 控件创建主/从表单
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.