开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜