locked
How to plot chart for a given ID RRS feed

  • Question

  • User-1557173817 posted

    Hello, i want to plot a chart for a giving ID but was some error, this my code;

    @{
        var db = Database.Open("StarterSite");
         var  ID = Request.QueryString["ID"];
        var data = db.Query("SELECT Subject, Grade FROM resulta WHERE SID=@0");
        var myChart = new Chart(width: 1100, height: 400)
            .AddTitle("Student Chart")
           .AddSeries("Default",chartType: "Column",
        xValue:  data, xField: "Subject",
        yValues:data, yFields: "Grade", ID)
            .Write();
    }

    Friday, November 6, 2015 5:23 AM

Answers

  • User1853794821 posted

    Your requirement statement is not terribly clear, but, for openers, your query never has the ID passed into SID:

    var data = db.Query("SELECT Subject, Grade FROM resulta WHERE SID=@0");

    Try addint the ID v ariable:

    var data = db.Query("SELECT Subject, Grade FROM resulta WHERE SID=@0", ID);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 6, 2015 9:05 AM