foreach(DataRowView DRV in Dv_Source)
{
t = DRV.Row["realid"].ToString();  // realid=32 and other int type.
         t        += "|" + GetInfoById(System.Int32.Parse(t));
         
}public string GetInfoById(int/*System.Int32 这也试改过了*/ identity)
{
  //todo function.
}错误提示:输入字符串的格式不正确?

解决方案 »

  1.   

    试下这样
    int tt;
    tt = convert.int32(t);
    t += "|" + GetInfoById(tt);不过我觉得你的这段话有问题.
      

  2.   

    int p;
    t = DRV.Row["realid"].ToString();  
    p = Convert.ToInt32(t);
    t += "|" +GetInfoById(p);
    错误还是一样
      

  3.   

    int p;
    p = convert.int32(DRV.Row["realid"]);  
    t += "|" +GetInfoById(p);
    这样。
      

  4.   

    写法似乎没错~
    常见原因是因为你的T第一次付值是空值。。
    后来int转换的时候自然就会出错了跟踪看看~  :)