首页 新闻 会员 周边 捐助

silverlight 3 webservice DataGrid

0
悬赏园豆:5 [已关闭问题] 关闭于 2010-06-11 12:20

在webservice里定义了方法
 [WebMethod]
  public List<m_article> GetsimpleList(string strWhere)
  {
  StringBuilder strSql = new StringBuilder();
  strSql.Append("select [BH],[topicbh],[Title],[Author] ");
  strSql.Append(" FROM J_Articles ");
  if (strWhere.Trim() != "")
  {
  strSql.Append(" where " + strWhere);
  }
  strSql.Append(" order by publishdate desc");
  DataTable dt= DbHelperSQL.Query(strSql.ToString()).Tables[0];
  List<m_article> articles=new List<m_article>();
  foreach(DataRow row in dt.Rows)
  {
  m_article article=new m_article();
  article.Title=row["title"].ToString();
  article.Author=row["author"].ToString();
  articles.Add(article);
  }
  return articles;
  }
在silverlight里绑定
private void UserControl_Loaded(object sender, RoutedEventArgs e)
  {
  DataBaseOperateSoapClient client = new DataBaseOperateSoapClient();
  client.GetsimpleListCompleted += new EventHandler<GetsimpleListCompletedEventArgs>(client_GetsimpleListCompleted);
  client.GetsimpleListAsync("");
  }
 void client_GetsimpleListCompleted(object sender, GetsimpleListCompletedEventArgs e)
  {
  if (e.Error == null)
  {
 
  dataGrid.ItemsSource = e.Result ;   
  }  

  }
在这句 dataGrid.ItemsSource = e.Result ;   
  
出现以下错误:

 无法将类型“databaseoperateServiceReference.GetsimpleListResponseGetsimpleListResult”隐式转换为“System.Collections.IEnumerable”。存在一个显式转换(是否缺少强制转换?) 

叶子绿了的主页 叶子绿了 | 初学一级 | 园豆:50
提问于:2010-06-11 11:21
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册