日期:2014-05-18  浏览次数:20459 次

ASP.NET里面的SQL语句语法格式
SELECT CAST(CAST(Yewuzhunquelv * 100 AS numeric(10, 2)) AS varchar(50)) + '%' AS Yewuzhunquelv FROM Tdefen 可以查询数据结果是69.00%。但在ASP.NET就搞不懂格式,这样string scd2 = "SELECT [Banzu], [Xingming],CAST(CAST(Yewuzhunquelv * 100 AS numeric(10, 2)) AS varchar(50)) + '%' AS Yewuzhunquelv from Tdefen"。不是每列都要cast,我只要其中一列Yewuzhunquelv 就行。格式或者说语法怎样啊,搞半天了

------解决方案--------------------
你先使用
string scd2="SELECT CAST(CAST(Yewuzhunquelv * 100 AS numeric(10, 2)) AS varchar(50)) + '%' AS Yewuzhunquelv FROM Tdefen"
看是否正确