首页 > 解决方案 > 如果在选择查询c#中的行受到影响后条件失败

问题描述

using (SqlCommand command7 = new SqlCommand("select * from table where cokumn2 = 'YES'", conn))
{
    command7.CommandType = CommandType.Text;

    using (SqlDataReader dr = command7.ExecuteReader())
    {
      if (dr.HasRows)
      {
        try
        { MailMessage mail = new MailMessage(); }
        catch (Exception) {}
      }
    }
}

即使选择查询受到影响的行,它也不会进入 if 条件,请对此提供帮助

标签: c#sqlado.net

解决方案


推荐阅读