Click here to Skip to main content
16,013,581 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to check the row value in table are match the condition then further process is done other wise another process like if table row is 'MRP' then tax calculation on MRP if row is rate then tax on rate,if row is sale rate then tax on sale rate etc.any one help me
Posted
Comments
[no name] 9-Nov-11 3:37am    
What have you tried?
[no name] 9-Nov-11 3:49am    
I think, and just I can predict, because your question is vague.

You wanted to do some calculation on the basis of value you have in database column. Weather column's value is "MRP" or "Rate" your calculation goes different. Is this correct?

1 solution

C#
string strAnswer = GetAnswerFromDB();//fetch your value from DB
//do google if you want to know Ho to fetch value from DB using c#

//Check your conditions as below

switch (strAnswer.toUpper())
{
   case "MRP":
      DoActionRelatedtoMRP();
      break;
   case "RATE":
      DoActionRelatedtoRATE();
      break;
   case "SALE RATE":
      DoActionRelatedtoSALERate();
      break;
    default:
       DoCommonAction();
       break;
}

private void DoActionRelatedtoMRP()
{
//do something when condition is MRP
}

private void DoActionRelatedtoRATE()
{
//do something when condition is RATE
}

private void DoActionRelatedtoSALERate()
{
//do something when condition is SALE RATE
}

private void DoCommonAction()
{
//do something when no expected condition matches
}


click Accept Answer button if solves your problem.. it motivates :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900