【问题标题】:How to get the Latest Currency Exchange Rate in your Asp.net Application如何在您的 Asp.net 应用程序中获取最新的货币汇率
【发布时间】:2013-07-10 12:40:04
【问题描述】:

如何在您的 Asp.net 应用程序中获取最新的货币汇率。是否有任何内置 API 可用于从网络获取最新汇率。

要求:

要求是我有一个印度卢比的计算值,在下拉列表中选择的货币上,该值应该改变。

例如,如果我从下拉列表中选择美元,则计算值应转换为美元。 为此,我想使用一些 WebService 从网上获取最新的汇率。

下拉列表的 OnselectedIndexchange 事件我想调用网络服务来获取不同世界货币的数据。

【问题讨论】:

标签: c# asp.net


【解决方案1】:

没有“内置”api。

您需要找到此类数据的提供者。

您可能想从https://openexchangerates.org/开始

【讨论】:

    【解决方案2】:

    大家好,我得到了上述问题的解决方案。

    转到http://webservicex.net,这是为ExchangeRate 提供WebService

    这是我所做的代码。

    在您的客户端应用程序中添加服务引用

    CurrencyConvertor 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);
    }
    

    【讨论】:

    【解决方案3】:

    .NET Framework 中没有内置任何东西来获取汇率,但您可能想查看以前的 StackOverflow 问题 Are there any free foreign exchangex rate web services?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-27
      • 1970-01-01
      • 2017-06-10
      • 1970-01-01
      相关资源
      最近更新 更多