Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net assign data to a chart

Hi

I use the code below to populate GridView in ASP.net 4 VB.net.
I need to populate a chart with the same data. What code would I use to do this?
Protected Sub Button_View_Results_Click(sender As Object, e As EventArgs) Handles Button_View_Results.Click

        If Me.Label_Reviewer.Text = "" Then
            Me.Label_Please_LogIn.Text = "Please log in first!"
            Exit Sub
        End If
        Me.Label_Please_LogIn.Text = ""

        'If Not IsPostBack Then

        Dim sSQL As String
        sSQL = "SELECT Answers.Survey, Answers.Category, Avg(Answers.Score) * 20 AS [Result Percentage] "
        sSQL = sSQL & "FROM Answers "
        sSQL = sSQL & "GROUP BY Answers.Survey, Answers.Category, Answers.ReviewerID "
        sSQL = sSQL & "HAVING (((Answers.ReviewerID)='" & Me.Label_Reviewer.Text & "'))"
        'sSQL = sSQL & "HAVING (((Answers.ReviewerID)='R'))"

        Dim queryString2 As String = sSQL


        ' Run the query and bind the resulting DataSet
        ' to the GridView control.
        Dim ds2 As DataSet = GetData(queryString2) 'test connection
        If (ds2.Tables.Count > 0) Then

            Me.GridView1.DataSource = ds2
            Me.GridView1.DataBind()

        Else

            'Me.Label_Error1.Text = "Unable to connect to the database. " & Err.Description

        End If
  

        ' End If
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

thanks for the help