how to check if a datareader is null or empty

前端 未结 12 1770
谎友^
谎友^ 2020-12-24 01:52

I have a datareader that return a lsit of records from a sql server database. I have a field in the database called "Additional". This field is 50% of the time emp

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 02:15

    if (myReader.HasRows) //The key Word is **.HasRows**
    
    {
    
        ltlAdditional.Text = "Contains data";
    
    }
    
    else
    
    {   
    
        ltlAdditional.Text = "Is null Or Empty";
    
    }
    

提交回复
热议问题