我想从wcf服务的数据绑定到网格silverlight应用程序。Silverlight Wcf绑定网格
我正在这样做。
这是我的服务类
public class Employee
{
public string Adres { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Region { get; set; }
}
public List<Employee> CustomerList()
{
OracleConnection conn = new OracleConnection("connectionstring");
OracleCommand cmd = new OracleCommand();
var custList = new List<Employee>();
cmd.CommandText = "select * from EMPLOYEES";
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Open();
OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (dr != null)
{
while (dr.Read())
{
var cust = new Employee
{
Adres = dr.GetString(7),
Country = dr.GetString(11),
};
custList.Add(cust);
}
}
return custList;
}
和Silverlight应用程序代码
client.CustomerListCompleted += new EventHandler<CustomerListCompletedEventArgs>(client_CustomerListCompleted);
client.CustomerListaAsync();
}
void client_CustomerListCompleted(object sender, CustomerListCompletedEventArgs e)
{
gridControl1.ItemsSource = e.Result[0];
}
这是工作,但我不得不执行多个SQL查询,我无法实现对每一类one.how我可以做这个任务。
谢谢。
你是什么意思的“必须执行多个SQL查询”?除了客户名单之外,您是否还有其他需要获取的数据集,并且正在寻找一种将其返回客户端的优化方法? – KodeKreachor 2012-03-20 00:34:22