Visual Studio does not access an asp.net class instance

I use this function List<LineData> list = LineData.getData();on my aspx.cs page to reference my class to get my data. The only problem is that my request no longer contains the element to which I accept the error. I get an invalid object name error. I tried a breakpoint and it never reaches any breakpoint that I set even when the page loads (I set a breakpoint on List<LineData> list = LineData.getData();). This is also very important when loading a page. We changed the database, and I changed the connection string in the configuration file and the name of the table in my query. I do not understand why this is happening. I'm not sure which code should be placed in the instance, so what would you like to see let me know.

** He says that my old connection string is an invalid object name.

Stack trace:

[SqlException (0x80131904): Invalid object name "BeforeWorkOrder".] DataClassLibrary.LineData.getData () +980 Line1.Page_Load (object sender, EventArgs e) in c: \ Users \ K \ Dropbox \ K Stuff \ CoolerManagement \ Line1. aspx.cs: 16 System.Web.Util.CalliEventHandlerDelegateProxy.Callback (object sender, EventArgs e) +51 System.Web.UI.Control.OnLoad (EventArgs e) +92 System.Web.UI.Control.LoadRecursive () + 54 System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Here is the problem on my aspx.cs page

List<LineData> list = LineData.getData();

Here is my DataClass

public static List<LineData> getData()
{
    List<LineData> list = new List<LineData>();

    StringBuilder sqlString = new StringBuilder();
    sqlString.Append("SELECT * ");
    sqlString.Append("FROM WorkOrder ");
    sqlString.Append("WHERE LineCompleted =  'false' ");

    SqlDataReader reader = null;
    SqlConnection dbConn = DBHelper.getConnection();

    try
    {
        reader = DBHelper.executeQuery(dbConn, sqlString.ToString(), null);
        if (reader != null)
        {
            while (reader.Read())
            {
                **Data ld = new **Data();
                ld.OrderID = (int)reader["OrderID"];
                ld.PNumber = reader["PNumber"].ToString();
                ld.ItemCode = reader["CaseNum6"].ToString();
                ld.BrandCode = reader["CaseNum9"].ToString();
                ld.CasesRemaining = (int)reader["CasesRemaining"];
                ld.Group = (Group)reader["Group"];
                list.Add(ld);
            }
            reader.Close();
            reader.Dispose();
            dbConn.Close();
            dbConn.Dispose();
        }
        else
            throw new Exception("No records returned");
    }
    catch (Exception ex)
    {
        throw ex;
    }
    finally
    {
        if (dbConn != null)
        {
            try { dbConn.Close(); dbConn.Dispose(); }
            catch { }
        }
        if (reader != null)
        {
            try { reader.Close(); reader.Dispose(); }
            catch { }
        }
    }
    return list;
}
+4
source share

All Articles