如何在您的 Asp.net 应用程序中获取最新的货币汇率。是否有任何内置 API 可用于从网络获取最新汇率。
要求:
要求是我有一个印度卢比的计算值,在下拉列表中选择的货币上,该值应该改变。
例如,如果我从下拉列表中选择美元,则计算值应转换为美元。为此,我想使用一些 WebService 从 Web 获取最新的汇率。
下拉列表的 OnselectedIndexchange 事件我想调用 web 服务来获取不同世界货币的数据。
There is no 'build-in' api.
You need to find the provider of such data.
You might want to start with https://openexchangerates.org/
大家好,我得到了上述问题的解决方案。
转到http://webservicex.net,这是为 ExchangeRate 提供 WebService
这是我所做的代码。
在您的客户端应用程序中添加服务参考
然后在您的客户端应用程序中创建代理对象
CurrencyExchange.CurrencyConvertor exchangerate = new CurrencyExchange.CurrencyConvertor();
double exchangevalue;
if (DropDownListcurrencies.SelectedValue == "UAE Dhiram")
{
exchangevalue = exchangerate.ConversionRate(CurrencyExchange.Currency.INR,CurrencyExchange.Currency.AED);
resultuae = result * Convert.ToDecimal(exchangevalue);
}
.NET Framework 中没有内置任何东西来获取汇率,但您可能想查看以前的 StackOverflow 问题是否有免费的外汇汇率 Web 服务?