这种写法如何改成这种写法的?
string sqlstr = "select top 10 * from 飞狐工作室";
sqlcon = new SqlConnection(strCon);
SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlcon);
DataSet myds = new DataSet();
sqlcon.Open();
myda.Fill(myds, "飞狐工作室");
GridView1.DataSource = myds;
GridView1.DataKeyNames = new string[] { "身份证号码" };
GridView1.DataBind();
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
DataRowView mydrv = myds.Tables["飞狐工作室"].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();
}
这种把方法设置一个公共的类里面,但是想实现某单元格变色,球哥哥姐姐帮忙
String cardName = SqlStringFormat.GetQuotedString(this.DropDownListCardNameInput.SelectedItem.Text);
String where = " Where CardName=" + cardName + "";
DataSet ds = DetailInfo.QueryCardInfo(table, where);
GridViewQueryDetailInfo.DataSource = ds;
this.GridViewQueryDetailInfo.DataKeyNames = new string[] { "DetailInfoID" };
GridViewQueryDetailInfo.DataBind();
for (int i = 0; i <= GridViewQueryDetailInfo.Rows.Count - 1; i++)
{