我在Silverlight 5中创建了Pivot
查看器客户端,我的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;
}
}