1

I have created Pivot viewer client in Silverlight 5, my Service class looks like below. How do I assign the Pivot.ItemsSource to this service class below? I have already added a service reference but cannot get to pass the data from the MySQL database to the pivot viewer. Any help is greatly appreciated.

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; 
    }
}
AlexB
  • 7,302
  • 12
  • 56
  • 74
Rohit Acharya
  • 47
  • 1
  • 7

0 Answers0