开发者

C# DATASET RELATIONS

开发者 https://www.devze.com 2023-03-02 00:32 出处:网络
I have two table Parent Table STUDENT ====> ID,NAMESqlCommand==>Select * from Student ChildTable Lessons ====> ID,STUDENTID,LESSONSqlCommand==>Select * from Lessons

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

I add 2 datagridview to my form.

First Table DataSource=Dataset.Relations[0].ParentTable;

Second Table DataSource=Dataset.Relations[0].ChildTable;

its not working like relational.H开发者_JS百科ow can I MAke child table StudentId defaultvalue parent table ID value


The second grid DataSource should be set to the DataSet.Relations[0] object. In this case, everything will work properly. Also, just found an MSDN article:

Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls

0

精彩评论

暂无评论...
验证码 换一张
取 消