static public int sqlCount(string sqlString)
    {
            conn.Open();
            OleDbCommand com = new OleDbCommand(sqlString, conn);
            int count = Convert.ToInt32(com.ExecuteScalar());
            return count;
    }

解决方案 »

  1.   

    ?public  static  int sqlcount(……)
      

  2.   

    static public int sqlCount 什么写法 
    你的sql语句呢
      

  3.   

    先把你sql语句选出来的值放在一个datatable中
    然后对datatable.row.count;
    就能知道你sql中有几条数据了
      

  4.   

    select count(*) from XXX,
    执行这个不比取到数据看行数好吧。
    我用这个。
      

  5.   

    这是我写在.cs中的类。sql语句: 
    protected void Button1_Click(object sender, EventArgs e)
        {
            int i = DataAccess.sqlCount("select count(*) from WORDS");
            Response.Write(i.ToString());
        }