嗯,這個正確!記住在datagrid中定義column.mappingname的時候是
datagrid1.column.MappingName= "xxx"
select f1,f2,case
when f3='1' then '人民币'
when f3='2' then '美元'
end as xxx,f4
from table1
如果你覺得不好的話,可以再建立一個表來存儲幣別,這樣就可以用
Select f1,f2,f3,pay_ccy_name from table1
left outer jion Table_pay_ccy on f3=pay_ccy
在ItemDataBound事件中判断值,然后用:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
' Retrieve the text of the CurrencyColumn from the DataGridItem
' and convert the value to a Double.
Dim strSex As String = e.Item.Cells(3).Text
' Format the value as currency and redisplay it in the DataGrid.
If strSex = "True" Then
e.Item.Cells(3).Text = "上线"
Else
e.Item.Cells(3).Text = "离线"
End If