Hi Team,
somewhere i am getting confused.
i have three column as follows:
Month
Tech
Circle
according to this column i need to fetch the data.
In Month Column, Data is :Jan,feb.March... and so on.
In Tech Column, Data is : Gsmnqi,Gsmboi ... and so on.
In Circle Column, Data is :Ap,Kol,Mumbai..and so on ...
I want to prove four condition as follows:
1 st condition
if i select the month it will fetch the data related to month ,Tech and circle will not be selected.
2 st condition
if i select the month and Tech it will fetch the data related to month and Tech ,circle will not be selected.
3 st condition
if i select the month and circle it will fetch the data related to month and circle ,Tech will not be selected.
4 st condition
if i select month,Tech and Circle it will fetch the data related to Month,tech and Circle.
But my if condition is not working ,seriously i get confused in if ,else and else if for this four condition.
if (nqiSqiEntity.Month != string.Empty)
{
query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' order by id asc");
}
else if (nqiSqiEntity.Month != string.Empty && nqiSqiEntity.Tech != string.Empty)
{
query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and TECH = '" + nqiSqiEntity.Tech + "' order by id asc");
}
else if (nqiSqiEntity.Month != string.Empty && nqiSqiEntity.Circle != string.Empty)
{
query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and CIRCLE = '" + nqiSqiEntity.Circle + "' order by id asc");
}
else
{
query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and CIRCLE = '" + nqiSqiEntity.Circle + "' and TECH '" + nqiSqiEntity.Tech + "' order by id asc");
}
In condition, Instead of string.Empty i need to put the value or i need to check if the value is present then only condition should get executed.if i check nqiSqiEntity.Month >0 it gives me error Error 45 Operator '>' cannot be applied to operands of type 'string' and 'int'.
Please help me from this situation.
Thanks in advance
Harshal