System.InvalidCastException: 无法将类型为“System.Data.DataRow”的对象强制转换为类型“System.IConvertible”。谁知道怎么怎么解决呢Code:
  DataSet dc = GetUserInfo();
  
  int id= Convert.ToInt32(dc.Tables[0].Rows[0]);

解决方案 »

  1.   

    int id= Convert.ToInt32(dc.Tables[0].Rows[0].toString());
      

  2.   

    int id= Convert.ToInt32(dc.Tables[0].Rows[0]);
    改为
    int id= Convert.ToInt32((你的控件类型)dc.Tables[0].Rows[0].FindControl("你的控件名字").**Text或者selectvalue或者其他属性**.ToString());
      

  3.   

    DataSet dc = GetUserInfo(); 
      
      int id= Convert.ToInt32(dc.Tables[0].Rows[0]); 
      改为 
      int id= Convert.ToInt32(dc.Tables[0].Rows[0]["字段名"]);
      

  4.   

    1楼正解
        dc.Tables[0].Rows[0] 是 DataRow 对象
         这样写你并没有指定到具体是那一个!, 这样写只是确定到数据是那一行的.......
      

  5.   

    dc.Tables[0].Rows[0][第几列].ToString()或dc.Tables[0].Rows[0]["字段名"].ToString()
      

  6.   

    DataSet dc = GetUserInfo(); 
    int id= Convert.ToInt32(dc.Tables[0].Rows[0][列名或者列所处位置].ToString());
      

  7.   

    DataSet dc = GetUserInfo(); 
    int id= Convert.ToInt32(dc.Tables[0].Rows[0][index or columnName].ToString());