violette 0 Junior Poster in Training

This code supposedly generate a web chart but it does not work. How is the correct way to bind data using SQL into web chart. thank you all :)

Function GetReader() As IDataReader

       Dim strSQL As String

       strSQL = " SELECT aa.alert_id, "

       strSQL = strSQL & " (SELECT alert_value a "
       strSQL = strSQL & " FROM company_alert a "
       strSQL = strSQL & " WHERE a.alert_id=aa.alert_id AND a.stock_code='" & bplc & "'  AND year_id= '" & byear1 & "' AND a.period_id= 0 ) AS b1 , "

       strSQL = strSQL & " (SELECT alert_value b "
       strSQL = strSQL & " FROM company_alert b "
       strSQL = strSQL & " WHERE b.alert_id=aa.alert_id AND b.stock_code='" & bplc & "'  AND year_id= '" & byear2 & "' AND b.period_id= 0 ) AS b2 "

       strSQL = strSQL & " FROM ref_alert aa "

       Return Command.ToString()
   End Function

   Protected Sub Chart()

       Dim reader3 As IDataReader = GetReader()
       Dim reader4 As IDataReader = GetReader()


       Dim chart3 As New WebChart.ColumnChart()
       chart3.DataXValueField = "alert_id"
       chart3.DataYValueField = "b1"
       chart3.DataSource = reader3
       chart3.DataBind()
       reader3.Close()
       chart3.Fill.Color = Drawing.Color.LightGray
       chart3.DataLabels.Visible = True
       chart3.DataLabels.NumberFormat = "0.00"
       chart3.Legend = byear1
       ChartControl1.Charts.Add(chart3)
       ChartControl1.RedrawChart()

       Dim chart4 As New WebChart.ColumnChart()
       chart4.DataXValueField = "alert_id"
       chart4.DataYValueField = "b2"
       chart4.DataSource = reader4
       chart4.DataBind()
       reader4.Close()
       chart4.Fill.Color = Drawing.Color.Orange
       chart4.DataLabels.Visible = True
       chart4.DataLabels.NumberFormat = "0.00"
       chart4.Legend = byear1
       ChartControl1.Charts.Add(chart4)
       ChartControl1.RedrawChart()

   End Sub