我有以下查询
SELECT SUM(Price) AS Sales
FROM BarOrder
WHERE (OrderDate <= @OrderDateEnds) AND (OrderDate >= @OrderDateStarts)
我的价格字段设置为Float,因此可以存储美分。那部分工作正常。现在我想使用以下
以货币格式检索信息 lblTodayAmount.Text = Cstr(BarOrderTableAdapter.TodaysSalesAmount(CDate(strEndDay), CDate(strBeginDay)))("C")
我得到以下内容:
Conversion from string "C" to type 'Integer' is not valid.
如果我执行以下操作:
BarOrderTableAdapter.TodaysSalesAmount(CDate(strEndDay), CDate(strBeginDay))("C")
然后我得到:
No default member found for type 'Double'.
答案 0 :(得分:1)
使用ToString
,而不是CStr
lblTodayAmount.Text = BarOrderTableAdapter.TodaysSalesAmount(CDate(strEndDay), CDate(strBeginDay)).ToString("C")