using (SqlConnection con = new SqlConnection(Connectionstring.Connection))
{
string query = "select Opportunity_Title as [Name of Opportunity],Rate as [Rate],Opportunity_ID from Table_Opportunity";
using (SqlDataAdapter ad = new SqlDataAdapter(query, con))
{
DataSet ds = new DataSet();
ad.Fill(ds, "Table_Opportunity");
dataGridView1.DataSource = ds.Tables[0];
foreach (DataRow dr in ds.Tables["Table_Opportunity"].Rows)
{
int rate = 0;
rate = Convert.ToInt32(dr["Rate"].ToString());
switch (rate)
{
case 0:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
//Experts here I have created dgvbtncol now I want to set the dgvbtncol.text to be LOW if
//if case is from 0 to 5 else if rate is from 6 to 10 it should be HIGH
break;
case 1:
DataGridViewButtonColumn DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 2:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 3:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 4:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 5:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 6:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 7:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 8:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 9:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
case 10:
DataGridViewButtonColumn dgvbtncol = new DataGridViewButtonColumn();
break;
default:
MessageBox.Show("Please check there is an Opportunity which has no Rate stated.");
break;
}
}
}
}
|