本文介绍了与父表有关系时,如何在子表中插入记录.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拿了2张桌子-> 1)Dayprogram1
2)TimeAllocate

我已经把他们两个都联系起来了

I have taken 2 tables -> 1)Dayprogram1
2)TimeAllocate

and i have taken relation both of them like

con = new SqlConnection("Initial Catalog=customer;data source=arun;Integrated Security=SSPI");
            da = new SqlDataAdapter("Select * from dayprogram1", con);
            da1 = new SqlDataAdapter("Select * from TimeAllocate where code=100", con);
            ds = new DataSet();
            da.Fill(ds, "dayprogram1");
            da1.Fill(ds,"TimeAllocate");
            dr = new DataRelation("parent", ds.Tables["dayprogram1"].Columns["code"], ds.Tables["TimeAllocate"].Columns["code"]);
            ds.Relations.Add(dr);
            dr.ChildKeyConstraint.DeleteRule = Rule.None;
            dr.ChildKeyConstraint.UpdateRule = Rule.None;
            loaddata();


现在我想在TimeAllocate Table中输入一条记录...我没有一个主意...任何人都可以帮助我


Now i want to enter a record into TimeAllocate Table...I am not getting an idea...any one help me

推荐答案


这篇关于与父表有关系时,如何在子表中插入记录.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 15:40