G
Guest
Ok people, here is what I am trying to do.
I have a SqlDataReader that populates data into a DataGrid on a website.
I want to be able to make every row in the DataGrid "Red" where the cell
"Reason_Code" in that row != 0 . Reason_Code is a type INT
Below is the code I am using, anyone got any ideas.
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection nike01 = new SqlConnection();
nike01.ConnectionString =
"Server=nike-svr-01;Database=IASLogs;Trusted_Connection=True;";
SqlCommand ias_query = new SqlCommand();
ias_query.CommandText = "SELECT A1.timestamp as [Date], " +
"A1.F_Q_User_Name as [User], A1.NAS_Identifier as [Access Point], "+
"A1.Calling_Station_Id as [Calling Station], R1.Reason_Code,
R1.Reason_text "+
"FROM accounting_data A1, accounting_data A2, r_codes R1 "+
"WHERE A1.Class = A2.Class "+
"AND A1.Reason_Code = R1.reason_code ORDER BY A1.timestamp DESC";
ias_query.Connection = nike01;
nike01.Open();
DataGrid1.DataSource = ias_query.ExecuteReader();
DataGrid1.DataBind();
nike01.Close();
}
I have a SqlDataReader that populates data into a DataGrid on a website.
I want to be able to make every row in the DataGrid "Red" where the cell
"Reason_Code" in that row != 0 . Reason_Code is a type INT
Below is the code I am using, anyone got any ideas.
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection nike01 = new SqlConnection();
nike01.ConnectionString =
"Server=nike-svr-01;Database=IASLogs;Trusted_Connection=True;";
SqlCommand ias_query = new SqlCommand();
ias_query.CommandText = "SELECT A1.timestamp as [Date], " +
"A1.F_Q_User_Name as [User], A1.NAS_Identifier as [Access Point], "+
"A1.Calling_Station_Id as [Calling Station], R1.Reason_Code,
R1.Reason_text "+
"FROM accounting_data A1, accounting_data A2, r_codes R1 "+
"WHERE A1.Class = A2.Class "+
"AND A1.Reason_Code = R1.reason_code ORDER BY A1.timestamp DESC";
ias_query.Connection = nike01;
nike01.Open();
DataGrid1.DataSource = ias_query.ExecuteReader();
DataGrid1.DataBind();
nike01.Close();
}