C# 在单个查询中插入数据

C# 在单个查询中插入数据,c#,asp.net,wcf,odata,C#,Asp.net,Wcf,Odata,我有两张像这样的桌子 VendorProduct vp = new VendorProduct { VendorPartNo = txtVdrPartNoOrg10.Value }; 及 如何设置链接???看起来您正在尝试查找对象关系映射器(ORM)。首先看一下Microsoft的实体框架: Product p = new Product { MfgPartN

我有两张像这样的桌子

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


如何设置链接???

看起来您正在尝试查找对象关系映射器(ORM)。首先看一下Microsoft的实体框架:
Product p = new Product
            {
                MfgPartNo = lbMfgPartNoOrg10.Text,
                Description = txtDesOrg10.Text,
                Weight = Convert.ToDecimal(txtWeightOrg10.Value),
                VendorProducts = new System.Collections.ObjectModel.Collection<VendorProduct>() { vp }
            };
DataContext.AddObject("Product", p);
DataContext.SaveChanges();