Updated table data not displaying in web forms page

so I have updated a table for a class project (given to me that had work completed on it from previous students) and am now unable to view the data for the income statement page that it is used for. The columns I renamed/updated were previously 2012-2015 and now are 2020-2023.[enter image description here](https://i.sstatic.net/51flQsFH.png)
enter image description here

aspx file snippet

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><h5>Select A Company</h5>
<div class="row-fluid">
<div class="span6">
<asp:SqlDataSource ID="SqlDSCompany" runat="server" ConnectionString="<%$ ConnectionStrings:CPAConnectionString %>" SelectCommand="SELECT [CompanyName] FROM [Company]"></asp:SqlDataSource>
<asp:DropDownList ID="DDLCompany" runat="server" DataSourceID="SqlDSCompany" DataTextField="CompanyName" DataValueField="CompanyName" AppendDataBoundItems="True" AutoPostBack="true" OnSelectedIndexChanged="DDLCompany_SelectedIndexChanged">
<asp:ListItem Value="" Text="Select Company"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="container">
<table class="default">
<tr>
<td class="tdTitle" width="25%">
<h4><b>Period Ending</b></h4>
</td>
<!--<td width="14%">2019</td>-->
<td width="14%">2020</td>
<td width="14%">2021</td>
<td width="14%">2022</td>
<td width="14%">2023</td>
</tr>
</table>
<table class="default">
<tr>
<td class="tdTitle" width="25%">
<h5><b>Total Revenue:</b></h5>
</td>
<td width="14%">
<asp:Label ID="lblTotalRevenue1" runat="server"></asp:Label></td>
<td width="14%">
<asp:Label ID="lblTotalRevenue2" runat="server"></asp:Label></td>
<td width="14%">
<asp:Label ID="lblTotalRevenue3" runat="server"></asp:Label></td>
<td width="14%">
<asp:Label ID="lblTotalRevenue4" runat="server"></asp:Label></td>
</tr>
</table>
</code>
<code><h5>Select A Company</h5> <div class="row-fluid"> <div class="span6"> <asp:SqlDataSource ID="SqlDSCompany" runat="server" ConnectionString="<%$ ConnectionStrings:CPAConnectionString %>" SelectCommand="SELECT [CompanyName] FROM [Company]"></asp:SqlDataSource> <asp:DropDownList ID="DDLCompany" runat="server" DataSourceID="SqlDSCompany" DataTextField="CompanyName" DataValueField="CompanyName" AppendDataBoundItems="True" AutoPostBack="true" OnSelectedIndexChanged="DDLCompany_SelectedIndexChanged"> <asp:ListItem Value="" Text="Select Company"></asp:ListItem> </asp:DropDownList> </div> </div> <div class="container"> <table class="default"> <tr> <td class="tdTitle" width="25%"> <h4><b>Period Ending</b></h4> </td> <!--<td width="14%">2019</td>--> <td width="14%">2020</td> <td width="14%">2021</td> <td width="14%">2022</td> <td width="14%">2023</td> </tr> </table> <table class="default"> <tr> <td class="tdTitle" width="25%"> <h5><b>Total Revenue:</b></h5> </td> <td width="14%"> <asp:Label ID="lblTotalRevenue1" runat="server"></asp:Label></td> <td width="14%"> <asp:Label ID="lblTotalRevenue2" runat="server"></asp:Label></td> <td width="14%"> <asp:Label ID="lblTotalRevenue3" runat="server"></asp:Label></td> <td width="14%"> <asp:Label ID="lblTotalRevenue4" runat="server"></asp:Label></td> </tr> </table> </code>
<h5>Select A Company</h5>
                            <div class="row-fluid">
                                <div class="span6">
                                    <asp:SqlDataSource ID="SqlDSCompany" runat="server" ConnectionString="<%$ ConnectionStrings:CPAConnectionString %>" SelectCommand="SELECT [CompanyName] FROM [Company]"></asp:SqlDataSource>
                                    <asp:DropDownList ID="DDLCompany" runat="server" DataSourceID="SqlDSCompany" DataTextField="CompanyName" DataValueField="CompanyName" AppendDataBoundItems="True" AutoPostBack="true" OnSelectedIndexChanged="DDLCompany_SelectedIndexChanged">
                                        <asp:ListItem Value="" Text="Select Company"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="container">
                                <table class="default">
                                    <tr>
                                        <td class="tdTitle" width="25%">
                                            <h4><b>Period Ending</b></h4>
                                        </td>
                                        <!--<td width="14%">2019</td>-->
                                        <td width="14%">2020</td>
                                        <td width="14%">2021</td>
                                        <td width="14%">2022</td>
                                        <td width="14%">2023</td>
                                    </tr>
                                </table>
                                <table class="default">
                                    <tr>
                                        <td class="tdTitle" width="25%">
                                            <h5><b>Total Revenue:</b></h5>
                                        </td>
                                        <td width="14%">
                                            <asp:Label ID="lblTotalRevenue1" runat="server"></asp:Label></td>
                                        <td width="14%">
                                            <asp:Label ID="lblTotalRevenue2" runat="server"></asp:Label></td>
                                        <td width="14%">
                                            <asp:Label ID="lblTotalRevenue3" runat="server"></asp:Label></td>
                                        <td width="14%">
                                            <asp:Label ID="lblTotalRevenue4" runat="server"></asp:Label></td>
                                    </tr>
                                </table>

code-behind

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Imports System.Data
Imports System.Data.SqlClient
Imports System.IO`
Partial Class IncomeStatement
Inherits System.Web.UI.Page
Dim query As String
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
LoadNoValues()
End If
End Sub
Protected Function ConnectToDB(query As String) As SqlDataReader
Dim strConn As String = GlobalVariables.DataSource
'variables
Dim connnection As SqlConnection = Nothing
Dim cmd As SqlCommand = Nothing
Dim result As SqlDataReader = Nothing
'
Dim strSQL As String = query
connnection = New SqlConnection(strConn)
cmd = New SqlCommand(strSQL, connnection)
connnection.Open()
result = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Return result
End Function
Protected Sub DDLCompany_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim result As SqlDataReader = Nothing
Dim constructs As New List(Of String)()
constructs = LoadConstruct()
Try
'sanitization for Company Name
Dim Company As String = Trim(DDLCompany.SelectedValue)
Dim CompanyName As String = Company
Dim pattern As String = "[']"
Dim replacement As String = ""
Dim reg As New Regex(pattern)
If reg.IsMatch(Company) Then
Dim replaceCompany As String = reg.Replace(Company, pattern, replacement)
CompanyName = replaceCompany
End If
If DDLCompany.SelectedValue IsNot "" Then
For Each construct As [String] In constructs
query = "SELECT * FROM IncomeStatement WHERE Company = @CompanyName AND FinancialConstruct = @Construct"
result = ConnectToDB(query)
If result.Read() Then
'does not work after updating columns in IncomeStatement table
'unsure what is causing data not to display
Dim value1 As String = If(result.Item("Y2020") = 0, "-", result.Item("Y2020"))
Dim value2 As String = If(result.Item("Y2021") = 0, "-", result.Item("Y2021"))
Dim value3 As String = If(result.Item("Y2022") = 0, "-", result.Item("Y2022"))
Dim value4 As String = If(result.Item("Y2023") = 0, "-", result.Item("Y2023"))
'works
'Dim value1 As String = If(result.Item("Y2012") = 0, "-", result.Item("Y2012"))
'Dim value2 As String = If(result.Item("Y2013") = 0, "-", result.Item("Y2013"))
'Dim value3 As String = If(result.Item("Y2014") = 0, "-", result.Item("Y2014"))
'Dim value4 As String = If(result.Item("Y2015") = 0, "-", result.Item("Y2015"))
SetLabelValues(construct, value1, value2, value3, value4)
End If
Next
Else
LoadNoValues()
End If
Catch ex As Exception
Console.WriteLine(ex)
End Try
End Sub
Private Function LoadConstruct() As List(Of String)
'Return constructs
Dim constructs As New List(Of String)()
query = "Select Distinct FinancialConstruct From IncomeStatement"
Dim result As SqlDataReader = ConnectToDB(query)
For Each row In result
constructs.Add(row("FinancialConstruct"))
Next
Return constructs
End Function
Private Sub SetLabelValues(constructor As String, value1 As String, value2 As String, value3 As String, value4 As String)`
Select Case constructor
Case "Total Revenue"
lblTotalRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1))
lblTotalRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2))
lblTotalRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3))
lblTotalRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4))
Exit Select
Case "Cost of Revenue"
lblCostofRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1))
lblCostofRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2))
lblCostofRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3))
lblCostofRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4))
Exit Select
...
Private Sub LoadNoValues()
lblTotalRevenue1.Text = "-"
lblTotalRevenue2.Text = "-"
lblTotalRevenue3.Text = "-"
lblTotalRevenue4.Text = "-"
lblCostofRevenue1.Text = "-"
lblCostofRevenue2.Text = "-"
lblCostofRevenue3.Text = "-"
lblCostofRevenue4.Text = "-"
...
</code>
<code>Imports System.Data Imports System.Data.SqlClient Imports System.IO` Partial Class IncomeStatement Inherits System.Web.UI.Page Dim query As String Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then LoadNoValues() End If End Sub Protected Function ConnectToDB(query As String) As SqlDataReader Dim strConn As String = GlobalVariables.DataSource 'variables Dim connnection As SqlConnection = Nothing Dim cmd As SqlCommand = Nothing Dim result As SqlDataReader = Nothing ' Dim strSQL As String = query connnection = New SqlConnection(strConn) cmd = New SqlCommand(strSQL, connnection) connnection.Open() result = cmd.ExecuteReader(CommandBehavior.CloseConnection) Return result End Function Protected Sub DDLCompany_SelectedIndexChanged(sender As Object, e As EventArgs) Dim result As SqlDataReader = Nothing Dim constructs As New List(Of String)() constructs = LoadConstruct() Try 'sanitization for Company Name Dim Company As String = Trim(DDLCompany.SelectedValue) Dim CompanyName As String = Company Dim pattern As String = "[']" Dim replacement As String = "" Dim reg As New Regex(pattern) If reg.IsMatch(Company) Then Dim replaceCompany As String = reg.Replace(Company, pattern, replacement) CompanyName = replaceCompany End If If DDLCompany.SelectedValue IsNot "" Then For Each construct As [String] In constructs query = "SELECT * FROM IncomeStatement WHERE Company = @CompanyName AND FinancialConstruct = @Construct" result = ConnectToDB(query) If result.Read() Then 'does not work after updating columns in IncomeStatement table 'unsure what is causing data not to display Dim value1 As String = If(result.Item("Y2020") = 0, "-", result.Item("Y2020")) Dim value2 As String = If(result.Item("Y2021") = 0, "-", result.Item("Y2021")) Dim value3 As String = If(result.Item("Y2022") = 0, "-", result.Item("Y2022")) Dim value4 As String = If(result.Item("Y2023") = 0, "-", result.Item("Y2023")) 'works 'Dim value1 As String = If(result.Item("Y2012") = 0, "-", result.Item("Y2012")) 'Dim value2 As String = If(result.Item("Y2013") = 0, "-", result.Item("Y2013")) 'Dim value3 As String = If(result.Item("Y2014") = 0, "-", result.Item("Y2014")) 'Dim value4 As String = If(result.Item("Y2015") = 0, "-", result.Item("Y2015")) SetLabelValues(construct, value1, value2, value3, value4) End If Next Else LoadNoValues() End If Catch ex As Exception Console.WriteLine(ex) End Try End Sub Private Function LoadConstruct() As List(Of String) 'Return constructs Dim constructs As New List(Of String)() query = "Select Distinct FinancialConstruct From IncomeStatement" Dim result As SqlDataReader = ConnectToDB(query) For Each row In result constructs.Add(row("FinancialConstruct")) Next Return constructs End Function Private Sub SetLabelValues(constructor As String, value1 As String, value2 As String, value3 As String, value4 As String)` Select Case constructor Case "Total Revenue" lblTotalRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1)) lblTotalRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2)) lblTotalRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3)) lblTotalRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4)) Exit Select Case "Cost of Revenue" lblCostofRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1)) lblCostofRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2)) lblCostofRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3)) lblCostofRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4)) Exit Select ... Private Sub LoadNoValues() lblTotalRevenue1.Text = "-" lblTotalRevenue2.Text = "-" lblTotalRevenue3.Text = "-" lblTotalRevenue4.Text = "-" lblCostofRevenue1.Text = "-" lblCostofRevenue2.Text = "-" lblCostofRevenue3.Text = "-" lblCostofRevenue4.Text = "-" ... </code>
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO`

Partial Class IncomeStatement
    Inherits System.Web.UI.Page

    Dim query As String

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            LoadNoValues()
        End If
    End Sub
   
    Protected Function ConnectToDB(query As String) As SqlDataReader

        Dim strConn As String = GlobalVariables.DataSource


        'variables
        Dim connnection As SqlConnection = Nothing
        Dim cmd As SqlCommand = Nothing
        Dim result As SqlDataReader = Nothing
        '
        Dim strSQL As String = query
        connnection = New SqlConnection(strConn)
        cmd = New SqlCommand(strSQL, connnection)
        connnection.Open()
        result = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        Return result
    End Function
   
    Protected Sub DDLCompany_SelectedIndexChanged(sender As Object, e As EventArgs)
        Dim result As SqlDataReader = Nothing
        Dim constructs As New List(Of String)()
        constructs = LoadConstruct()
        Try
            'sanitization for Company Name
            Dim Company As String = Trim(DDLCompany.SelectedValue)
            Dim CompanyName As String = Company
            Dim pattern As String = "[']"
            Dim replacement As String = ""
            Dim reg As New Regex(pattern)
            If reg.IsMatch(Company) Then
                Dim replaceCompany As String = reg.Replace(Company, pattern, replacement)
                CompanyName = replaceCompany
            End If

            If DDLCompany.SelectedValue IsNot "" Then
                For Each construct As [String] In constructs
                    query = "SELECT * FROM IncomeStatement WHERE Company = @CompanyName AND FinancialConstruct = @Construct"
                    result = ConnectToDB(query)

                    If result.Read() Then
                        'does not work after updating columns in IncomeStatement table
                        'unsure what is causing data not to display
                        Dim value1 As String = If(result.Item("Y2020") = 0, "-", result.Item("Y2020"))
                        Dim value2 As String = If(result.Item("Y2021") = 0, "-", result.Item("Y2021"))
                        Dim value3 As String = If(result.Item("Y2022") = 0, "-", result.Item("Y2022"))
                        Dim value4 As String = If(result.Item("Y2023") = 0, "-", result.Item("Y2023"))

                        'works
                        'Dim value1 As String = If(result.Item("Y2012") = 0, "-", result.Item("Y2012"))
                        'Dim value2 As String = If(result.Item("Y2013") = 0, "-", result.Item("Y2013"))
                        'Dim value3 As String = If(result.Item("Y2014") = 0, "-", result.Item("Y2014"))
                        'Dim value4 As String = If(result.Item("Y2015") = 0, "-", result.Item("Y2015"))
                        SetLabelValues(construct, value1, value2, value3, value4)
                    End If
                Next
            Else
                LoadNoValues()
            End If
        Catch ex As Exception
            Console.WriteLine(ex)
        End Try
    End Sub
    
    Private Function LoadConstruct() As List(Of String)

        'Return constructs
        Dim constructs As New List(Of String)()
        query = "Select Distinct FinancialConstruct From IncomeStatement"
        Dim result As SqlDataReader = ConnectToDB(query)

        For Each row In result
            constructs.Add(row("FinancialConstruct"))
        Next
        Return constructs
    End Function
  Private Sub SetLabelValues(constructor As String, value1 As String, value2 As String, value3 As String, value4 As String)`
        Select Case constructor
            Case "Total Revenue"
                lblTotalRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1))
                lblTotalRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2))
                lblTotalRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3))
                lblTotalRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4))
                Exit Select
            Case "Cost of Revenue"
                lblCostofRevenue1.Text = If(value1 = "-", value1, FormatCurrency(value1))
                lblCostofRevenue2.Text = If(value2 = "-", value2, FormatCurrency(value2))
                lblCostofRevenue3.Text = If(value3 = "-", value3, FormatCurrency(value3))
                lblCostofRevenue4.Text = If(value4 = "-", value4, FormatCurrency(value4))
                Exit Select
...

 Private Sub LoadNoValues()
        lblTotalRevenue1.Text = "-"
        lblTotalRevenue2.Text = "-"
        lblTotalRevenue3.Text = "-"
        lblTotalRevenue4.Text = "-"

        lblCostofRevenue1.Text = "-"
        lblCostofRevenue2.Text = "-"
        lblCostofRevenue3.Text = "-"
        lblCostofRevenue4.Text = "-"
...

I was expecting the updated columns and updated years to work, but did not. I have tried using Chrome and Firefox with cleared cache. I also cleared the cache in visual studio as well. I was also thinking of refactoring to just have one label per year of each field so it wouldn’t need so many.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật