Click here to Skip to main content
15,908,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
C#
int actualcost = Convert.ToInt32(dt_sms.Rows[0]["Cost"].ToString());
                   int bargaincost = actualcost - 200;
                   string sql_cust= string.Format("SELECT CustomerMaster.CustomerName, CustomerMaster.Phoneno, CustomerMaster.EmailId, CostMaster.Cost, RequestMaster.SetCost FROM CostMaster INNER JOIN  ProductMaster ON CostMaster.ProductId = ProductMaster.ProductId INNER JOIN RequestMaster ON CostMaster.CostId = RequestMaster.CostId INNER JOIN CustomerMaster ON RequestMaster.CustomerId = CustomerMaster.CustomerId where CostMaster.AgentId='{0}' and ProductMaster.ProductId='{1}' and RequestMaster.SetCost Between actualcost and bargaincost")


Above is my code. actualcost and bargaincost are not in table. how to write this query.please help me
Posted

1 solution

Modify your query in following order.

string.format("SELECT CustomerMaster.CustomerName, CustomerMaster.Phoneno, CustomerMaster.EmailId, CostMaster.Cost, RequestMaster.SetCost FROM CostMaster INNER JOIN ProductMaster ON CostMaster.ProductId = ProductMaster.ProductId INNER JOIN RequestMaster ON CostMaster.CostId = RequestMaster.CostId INNER JOIN CustomerMaster ON RequestMaster.CustomerId = CustomerMaster.CustomerId where CostMaster.AgentId='{0}' and ProductMaster.ProductId='{1}' and RequestMaster.SetCost Between {2} and {3}", arg1, arg2, actualcost, bargaincost)
 
Share this answer
 
Comments
Lakshmimsridhar 1-Aug-13 4:14am    
thank u :)

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