Posted on: 12/5/2013 10:55:56 PM | Views : 851

Is there a way to test a data connection to SQL Server in the web.config to make sure that you have connected to the database correctly?, see below. I created a simple application to open a table and display each row. Every time I run this application I get an error: Object reference not set to an instance of an object in the "foreach (GEW.Models.Product prod in GetProducts())" in Listing.aspx. I don't think I have a correct connection. I need to be able to see that the connection was open and made correctly.
I have run this identical code with another database and another table and it worked fine. When I switched to another database and different table the error started.
====================================================================== Listing.aspx ====================================================================== <%@ Page Language="C#" AutoEvent ...

Go to the complete details ...