1

Pivot在 Silverlight 5 中创建了查看器客户端,我的Service课程如下所示。如何将 分配给Pivot.ItemsSource下面的此服务类?我已经添加了一个服务引用,但无法将数据从 MySQL 数据库传递到数据透视查看器。任何帮助是极大的赞赏。

public class Service1
{
    [OperationContract]
    public void DoWork()
    {
        // Add your operation implementation here
        return;
    }

    // Add more operations here and mark them with [OperationContract]

    [OperationContract]
    public List<Employee> GetAllEmployees()
    {
        var emps = new List<Employee>();
        string connect = ConfigurationManager.ConnectionStrings["yoyo"].ToString();
        using(var con = new SqlConnection(connect))
        {
            string query = "Select simpleid,brand FROM bob_reporting_sg.pivottable";
            var cmd = new SqlCommand(query, con);
            con.Open();
            using (var dr = cmd.ExecuteReader())
            {
                while(dr.Read())
                {
                    var emp = new Employee();
                    emp.EmployeeID = dr.GetInt32(0);
                    emp.FirstName = dr.GetString(1);
                    emps.Add(emp);

                }
            }
        }

        return emps; 
    }
}
4

0 回答 0