解决方案:主要是绑定后过滤
public void bind()
{
        string sqlstr = "select top 10 * from Employee";
        sqlcon = new SqlConnection(strCon);
        SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlcon);
        DataSet myds = new DataSet();
        sqlcon.Open();
        myda.Fill(myds, "Employee");
        GridView1.DataSource = myds;
        GridView1.DataKeyNames = new string[] { "身份证号码" };
        GridView1.DataBind();
       for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
        {
            DataRowView mydrv = myds.Tables["Employee"].DefaultView[i];
            string score = Convert.ToString(mydrv["起薪"]);
            if (Convert.ToDouble(score) < 34297.00)//大家这里根据具体情况设置可能ToInt32等等
           {
                GridView1.Rows[i].Cells[4].BackColor = System.Drawing.Color.Red;
            }
        }
        sqlcon.Close();
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-07-26
猜你喜欢
  • 2022-02-17
  • 2022-01-30
  • 2021-12-18
  • 2021-09-11
  • 2022-12-23
  • 2021-07-16
  • 2021-09-23
相关资源
相似解决方案