Home  /  Questions  /  Question

50   50
Mar 12, 2011

Need some help with "The underlying provider failed on Open"

Can anybody help me on this issue?

I set the ASP.NET Web application as start project and used the default setting for database connection. When trying to browse the product, I get the following error "The underlying provider failed on Open." at the highlighted line below: 

public List<Product> GetProductsByCategory(int categoryId, string sortExpression)
    using (var context = DataObjectFactory.CreateContext()) 
       // Load single Category with all Product child records
       var category = context.CategoryEntities.Include("Products")
                      .FirstOrDefault(c => c.CategoryId == categoryId);

       // Order by (using dynamic linq) without going back to db
       var products = category.Products.AsQueryable().OrderBy(sortExpression, null); 
       // Return list of business objects
       return products.Select(p => Mapper.Map(p)).ToList();

I am running this project using VS 2010 Professional on Windows Vista.


830   99.9
Mar 12, 2011

Here is a discussion on the same error:  http://stackoverflow.com/questions/2475008/the-underlying-provider-failed-on-open
From reading this article I suspect it is related to a MSDTC setting on your machine.

I hope this gets you going.
 1 comment
Thanks, Dan. I have fixed this problem by following the instrcuctions of above link to allow remote client for local DTC. --- Steven Cai  Mar 12, 2011

0   0
Jun 11, 2016
Thanks to the author..Best article...Here is my discussion on MSSQL underlying provider fialed error! Please visit!