首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

silverlight webservice 数据访问时出错,该怎么处理

2012-03-03 
silverlight webservice 数据访问时出错请各位帮忙解决,错误信息:尝试对参数 http://tempuri.org/ 进行反

silverlight webservice 数据访问时出错
请各位帮忙解决,
错误信息:
尝试对参数 http://tempuri.org/ 进行反序列化时出错

-----------------------------------------
 [WebMethod]
  public user[] GetUsers()
  {

  SqlConnection _sqlConnection = new SqlConnection();
  _sqlConnection.ConnectionString = ConfigurationManager.ConnectionStrings["sqlConnectionString"].ToString();
  _sqlConnection.Open(); SqlDataAdapter da = new SqlDataAdapter();
  da.SelectCommand = new SqlCommand("SELECT top 200 * FROM test", _sqlConnection);
  DataSet ds = new DataSet();
  da.Fill(ds);
  List<user> u = new List<user>() ;
  foreach (DataRow dr in ds.Tables[0].Rows)
  {
  user CC = new user();
  CC.JS_BH = dr["JS_BH"].ToString();
  CC.XM = dr["XM"].ToString();
  CC.BYYX = dr["BYYX"].ToString();
  CC.ZY = dr["ZY"].ToString();
  CC.GZNY = dr["GZNY"].ToString();
  u.Add(CC);
  }

  return u.ToArray();

  }

------------------------sl中调用-----------------------------
private void Page_Loaded(object sender, RoutedEventArgs e)
  {
  usera1.Service1SoapClient cl = new SilverlightApplication3.usera1.Service1SoapClient();
  cl.GetUsersAsync();
  cl.GetUsersCompleted+=new EventHandler<SilverlightApplication3.usera1.GetUsersCompletedEventArgs>(cl_GetUsersCompleted);

  }

  void cl_GetUsersCompleted(object sender, SilverlightApplication3.usera1.GetUsersCompletedEventArgs e)
  {
  if (e.Error == null)
  {
  this.dgPelope.ItemsSource = e.Result; //绑定结果到UI的List控件
  }
  }

[解决办法]
确认user实体有没有标记序列化,有没有特殊的类型。

热点排行