Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Obtaining Exchange Rates dynamically for use with ASP pages


Message #1 by laphan@u... on Sun, 14 Apr 2002 14:04:43 +0100 (BST)
Hi All

The subject may seem a bit deep, but I think my 
ASP query is pretty simple for somebody who knows.

Does anybody know of a way that I can obtain an 
exchange 'on the fly' so that when a user 
selects 'Show me in Euro' I can:

a) Fetch the current Euro exchange rate.

b) Take my normal stored Sterling price and times 
it against the exchange
rate I just fetched.

c) Display this result on the page.

Any assistance you can give would be very much 
appreciated.

Regards


Laphan

-------------------------------------------------
This mail sent through UK Online webmail
Message #2 by "Rob Parkhouse" <rparkhouse@o...> on Mon, 15 Apr 2002 02:10:42
Include some sql the retrieve the exchange rate from table

e.g. 

general code for any currency code

strConnect = a valid connection string
strSql = "SELECT ExRate FROM CurrTable WHERE CurrCode = '" & Request.Form
("CurrCode") & "'"

	' Create Connection and Recordset objects
	Set objConn = Server.CreateObject("ADODB.Connection")
	Set objRS = Server.CreateObject("ADODB.Recordset")
	
	' Connect to the database
	objConn.Open strConnect
	
	' get the Client record
	' *********************
	objRS.Open strSql,objConn, adOpenForwardOnly, adLockReadOnly, 
adCmdText
		
	ConvertedPrice = StgPrice * objRS("ExRate")
	objRS.Close
        Set objRS = Nothing
	
..... some ASP/HTMl to send back

If Euro is only currency you want to convert to, rather than doing a 
postback and looking up exchange rate table, perhaps you could send the 
Euro exchange rate with original page and use Client side Javascript to do 
immediate conversion when you select "show me in Euro" rather than going 
back to server to do it.

Good luck


> Hi All

The subject may seem a bit deep, but I think my 
ASP query is pretty simple for somebody who knows.

  Return to Index