Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi Everyone

I am calling a WebService and getting a double value from below code.

C#
double exchangevalue = exchangerate.ConversionRate(CurrencyExchange.Currency.INR, CurrencyExchange.Currency.AED);


Once i am connected to Internet i am getting the double value from webService and doing my stuff.

Suppose i am not connected to Internet,so i will not get value from the previous line of code,because it can't call the webservice.So i want to get the value from previous request.
So how to store the previous request value so that i can use that value when my Internet connection is off.

any kind of help will be appreciated.
Posted
Comments
[no name] 21-Jul-13 14:09pm    
What do you mean "how to store"? Store it in a file, a database, the registry, wherever you need to or whatever is convenient.

Just be logical: if you don't have a connection to a Web service, it does not even exist for you. If you have done some previous request and obtained the response, its gone, unless you store it somewhere in your client code. And how you do it, what exactly you store, how long request history you want to store — this all is totally up to you.

—SA
 
Share this answer
 
Well,you mentioned that you want to use 'Previous value',than when you get value from web service,store it somewhere at client. There are so many options for storing it.

When you dont have internet connection,get the stored value and perform the operation.When you get the internet connection,obtain value again and update it by replacing the already stored one.

Regards..:laugh:
 
Share this answer
 
Comments
Ashad25 22-Jul-13 4:27am    
Thanks.Can you please tell me what could be the convenient way for storing values,either i can store in DB or Registry.
Thanks7872 22-Jul-13 4:35am    
I recommend you to use database as there is no time criteria defined for the connection availability.
Ashad25 22-Jul-13 5:51am    
Thanks

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