DataSet.tables[0].rows.count==0
就可以了

解决方案 »

  1.   

    放在存储过程里多容易呀
    DECLARE @a
    set @a=(select count(id) from table)
    if @a=0
    不存在的操作
    else
    存在的操作
      

  2.   

    是没有查询到数据吧,如果用返回DATASET,就用楼上的,如果是SqlDataReader 
    if(dr.HasRows)
    {
        .....
    }
      

  3.   

    string cnsource = "连接字符串";
    SqlConnection cnn = new SqlConnection(cnsource);
    string quarry1 = "查询1";
    SqlCommand cmd1 = new SqlCommand(quarry1,cnn);
    int i = cmd1.ExecuteNonQuerry();
    if(i > 0)
          // do 任务1
    else
          // do 任务2