1
resposta

Não está avisual

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Web.Services; using System.Web.Script.Services;

public partial class jQueryGoogleChart : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { GetChartData(); } [WebMethod] [ScriptMethod (ResponseFormat = ResponseFormat.Json)] public static List GetChartData() { DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog=Venda;Integrated Security=True")) { con.Open(); SqlCommand cmd = new SqlCommand("SELECT ProductName as Name, COUNT(Pu) AS Total FROM Produto GROUP BY ProductName", con); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); con.Close(); } List dataList = new List(); foreach (DataRow dtrow in dt.Rows) { Produto details = new Produto(); details.ProductName = dtrow[0].ToString(); details.Pu = Convert.ToInt32(dtrow[1]); dataList.Add(details); } return dataList; }

public class Produto
{
    public string ProductName { get; set; }
    public int Pu { get; set; }
}

}

1 resposta

Fala ai Nsiam, tudo bem? Olhando os códigos postados não deu para tirar muita informação.

Consegue me passar mais detalhes sobre o que está precisando fazer? Como está fazendo e quais erros estão dando?

Assim fica mais fácil tentar te ajudar.

Fico no aguardo.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software