这是我的代码。它显示错误 在提供程序连接上启动事务时发生错误。有关详细信息,请参阅内部异常。
DemoEntities db = DemoEntities.CreateNewDemoEntity();
var query = (from f in db.Product_Table
where f.ReportID == reportID && f.StateID == stateID
select f);
foreach(var q in query)
{
Custom_Search_Transformation cst = new Custom_Search_Transformation()
{
CustomerID = customerID,
StateID = stateID,
FullProductID = q.FullProductID
};
db.Custom_Search_Transformation.AddObject(cst);
db.SaveChanges();
}
最佳答案
将您的可查询列表设为 .ToList() 它应该可以正常工作。
关于c# - 在提供程序连接上启动事务时发生错误。有关详细信息,请参阅内部异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21306377/