如何使用webservices从不同的记录中获取记录? [英] How do get records from different using webservices?
本文介绍了如何使用webservices从不同的记录中获取记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的数据库图表,我的场景是,当用户输入人数和金额,金额/人物
假设4/1000 = 250而现在250是,匹配Product_Price字段在RstProductDetails中,只选择250匹配的餐厅。接下来,当用户选择餐厅,例如肯德基,然后显示肯德基产品详细信息。
这是我的[WebMethod]
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(string Amount, string PersonHash)
{
// DataSet result = Amount / personHash;
DataSet result = null;
const string SQL_COMMAND_TEXT = "SELECT Rst_Name FROM RstProductDetails WHERE Product_Name WHERE Product_rice<=250 = @Rst_Name";
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("@PersonHash", SqlDbType.NVarChar);
command.Parameters["@Rst_Name"].Value = Amount;
command.Parameters["@PersonHash"].Value = PersonHash;
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
{
result = new DataSet();
dataAdapter.Fill(result);
}
}
}
return result;
}
推荐答案
好的很简单,你的功能是接受2个参数1)数量2)人物
$你函数中的b $ b计算金额
Ok it's very simple your function is accepting 2 parameters 1) Amount 2) Person
in your function calculate amount
decimal price = amount \ persons
和此价格作为参数
and this price as parameter
WHERE Product_rice< = @price";
command.Parameters.Add("@price", SqlDbType.Decimal);
command.Parameters["@price"].Value = price;
这篇关于如何使用webservices从不同的记录中获取记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文