【发布时间】:2015-08-21 06:10:52
【问题描述】:
我想将Label22.Text 和Label21.Text 的结果转换为带两位小数的数字。尝试了多种变体
sda = new SqlDataAdapter(@"SELECT fname, SUM([debit]/1.2) AS [D], SUM([credit]/1.2) AS [C] FROM detail GROUP BY fname", con);
DataSet ds = new DataSet();
sda.Fill(ds);
DataRow dr = ds.Tables[0].Select("fname = '0092632'").FirstOrDefault();
if (dr != null)
{
Label22.Text = dr["D"].ToString();
Label21.Text = dr["C"].ToString();
}
【问题讨论】:
-
目前你得到了什么??
-
Convert.ToDecimal() ?
-
小数点后 5 位的长数字,例如 1009.65891
-
致维沙尔。我得到了长达 5 位小数的长数字,例如 1009.65891
标签: c# sql-server type-conversion