Here is my Database diagram and my scenario is that When a user enter number of person and amount, amount/person
let suppose 4/1000=250 and now 250 is , match in Product_Price Field in RstProductDetails, and select only Restaurant where 250 is matched. Next when a
user select Restaurant e.g KFC and then KFC Products details is show.
Here is my [WebMethod]
[WebMethod]
public DataSet Restaurant(decimal amount, decimal persons)
{
// DataSet result = Amount / personHash;
//amount.ToString("amount");
decimal price = amount / persons ;
DataSet result = null;
const string SQL_COMMAND_TEXT = "SELECT Product_Name,Product_Price FROM ABCD WHERE Product_Price<= @price";
using (SqlConnection connection = Class1.GetConnection())
{
connection.Open();
using (SqlCommand command = new SqlCommand(SQL_COMMAND_TEXT, connection))
{
command.Parameters.Add("@Rst_Name", SqlDbType.NVarChar);
command.Parameters.Add("@Persons", SqlDbType.NVarChar);
command.Parameters.Add("@price", SqlDbType.Int);
command.Parameters["@Rst_Name"].Value = amount;
command.Parameters["@persons"].Value = persons;
command.Parameters["@price"].Value = price;
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
{
result = new DataSet();
dataAdapter.Fill(result);
}
}
}
return result;
}
- Edited by Ali Ashiq 16 hours 49 minutes ago