Tables(0).Rows.Count 为啥出错???SqlConnection conAll = new SqlConnection();
conAll.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlDataAdapter DaAll = new SqlDataAdapter(text, conAll);
DataSet dsAll = new DataSet();
try
{
   conAll.Open();
   DaAll.Fill(dsAll);   //错误 1Non-invocable member 'System.Data.DataSet.Tables' cannot be used like a method. D:\project\BDQry\WebApplication1\bdQry.aspx.cs 93
   if (dsAll.Tables(0).Rows.Count == 0) //Tables(0).Rows.Count 为啥出错???
   {   }
   GridView1.DataSource = dsAll;
   GridView1.DataBind();
}
finally
{
   conAll.Dispose();
   DaAll.Dispose();
   dsAll.Dispose();
   DaAll = null;
   conAll = null;
}

解决方案 »

  1.   

    DataSet这个类的定义是什么。。貌似是你自己定义的吧,因为jdk api中没有这个类
      

  2.   

     if (dsAll!=null && dsAll.Tables[0].Rows.Count == 0)    {   }
      

  3.   

    dsAll.Tables(0).Rows.Count == 0
    应该是方扩号:
    dsAll.Tables[0].Rows.Count == 0
      

  4.   

    第一是写法错误,dsAll.Tables[0].Rows.Count
    第二是DateSet中Table一个也没有,那么DateSet.Tables[0]就会等于NULL,dsAll.Tables[0].Rows.Count会报错。
      

  5.   

    老兄,这是.NET。干jdk鸟事。你跑错地方了吧
      

  6.   

    我去,研究。net的加我好友干嘛。汗