Microsoft Chart skipping first record from database RRS feed

  • Question

  • User1406973109 posted
    Hi All,
    Please i have this chart, that displays data from database, but the problem is that it skips the first record
    from the data generated. This is the chart:
    <asp:Chart ID="chtShareOfExpenditureNoFilter" runat="server" Width="550" Height="350">
                    <asp:Series Name="Brand" ChartType="Column" 
                        Palette="Chocolate" ChartArea="MainChartArea" 
                    <asp:ChartArea Name="MainChartArea" Area3DStyle-Enable3D="true">
    <Area3DStyle Enable3D="True"></Area3DStyle>
    This is the code for the database:
    Private Sub GetSOENoFilter()
            Dim objDr As SqlClient.SqlDataReader = Nothing
                objDr = CommonOperations.GetShareOfVoiceChart(_objConn, BeginDate, EndDate, Session("ProductCategory"))
                If objDr IsNot Nothing Then
                    If objDr.Read() Then
                        chtShareOfExpenditureNoFilter.Series("Brand").Points.DataBindXY(objDr, "Brand", objDr, "Total")
                    End If
                End If
            Catch ex As Exception
            End Try
        End Sub
    'This is the GetShareOfVoiceChart From CommonOperations
    Public Shared Function GetShareOfVoiceChart(ByVal DBConnection As SqlClient.SqlConnection, ByVal strBeginDate As DateTime, ByVal strEndDate As DateTime, ByVal strProductId As String) As SqlClient.SqlDataReader
            GetShareOfVoiceChart = Nothing
                Dim objDr As SqlClient.SqlDataReader = Nothing
                Dim objCmd As New SqlClient.SqlCommand
                Dim objParameters As SqlClient.SqlParameter()
                Dim objPara(2) As SqlClient.SqlParameter
                objPara(0) = New SqlClient.SqlParameter("@BeginDate", strBeginDate)
                objPara(0).DbType = DbType.DateTime
                objPara(0).Direction = ParameterDirection.Input
                objParameters = objPara
                objPara(1) = New SqlClient.SqlParameter("@EndDate", strEndDate)
                objPara(1).DbType = DbType.DateTime
                objPara(1).Direction = ParameterDirection.Input
                objParameters = objPara
                objPara(2) = New SqlClient.SqlParameter("@ProductId", strProductId)
                objPara(2).DbType = DbType.String
                objPara(2).Direction = ParameterDirection.Input
                objParameters = objPara
                objCmd.Connection = DBConnection
                objCmd.CommandText = "stp_GetShareOfVoiceReportByValueByChart_sel"
                objCmd.CommandType = CommandType.StoredProcedure
                objDr = objCmd.ExecuteReader()
                Return objDr
            Catch ex As Exception
            End Try
        End Function
    This is the Data from the Database, it skips the first record
    Brand               Amount
    AIRTEL	  	250161131.36
    ETISALAT(EMTS)	331935886.43
    GLOBACOM		178351275.85
    MTN		246827856.37
    MULTILINKS          234666.67
    VISAFONE		8123883.34
    ZOOM MOBILE	13612




    Friday, April 12, 2013 12:09 PM

All replies

  • User1242245693 posted


    Strange I tried the same with DataTable and its work like Gem.Can you please try it with Datatable.

    Thursday, July 21, 2016 4:30 AM