|
-
Oct 1st, 2003, 11:53 AM
#1
Thread Starter
Addicted Member
Formating Values From OleDbDataReader
I am retrieving Values from Access DB which I need to Format. I am using the following:
myDataReader = OleDbComm.ExecuteReader()
I want to Display the Formatted Values in a table in a DataList:
<td><%# Container.DataItem("Price") %></td>
The Format I want is as follows:
Dim MyDouble As Double = 123456789
Response.Write(MyDouble.ToString("C"))
How can I apply this to myDataReader so that I can display the formatted value for Price ?
-
Oct 1st, 2003, 02:42 PM
#2
PowerPoster
I am doing this by memory, and it may be wrong, but is in the right direction.
Code:
<td><%# DataBinder.Eval(Container.DataItem, "Price", {0:C}) %></td>
-
Oct 1st, 2003, 03:30 PM
#3
Thread Starter
Addicted Member
I have tried this but get a 'Expression expected' error ! Any Ideas ?
-
Oct 2nd, 2003, 02:51 AM
#4
Thread Starter
Addicted Member
I have also used this method:
<td><%# FormatValue(DataBinder.Eval(Container.DataItem, "Price")) %></td>
Public Function FormatValue(curr As Double) As Double
Response.Write(curr.ToString("C"))
Return curr.ToString("C")
End Function
The Function Returns the Price formatted correctly as currency from Response.Write (e.g £250,000) but the value in the table is NOT formatted (i get back 250000). Why does this not work ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|