在单个查询中插入数据

时间:2013-10-01 21:25:58

标签: c# asp.net wcf odata

我有两张表,比如

VendorProduct vp = new VendorProduct
            {
                VendorPartNo = txtVdrPartNoOrg10.Value
            };

Product p = new Product
            {
                MfgPartNo = lbMfgPartNoOrg10.Text,
                Description = txtDesOrg10.Text,
                Weight = Convert.ToDecimal(txtWeightOrg10.Value),
                VendorProducts = new System.Collections.ObjectModel.Collection<VendorProduct>() { vp }
            };

如何将 Insert 数据添加到这些表中

DataContext.AddObject("Product", p);
DataContext.SaveChanges();

如何设置链接??

0 个答案:

没有答案