 |
|
{"Unable to cast object of type 'System.Decimal' to type 'System.String'."}
นี่คือ error ที่ visual studio แจ้งมาค่ะ เท่าที่เข้าใจคือ ใน sql เรา select ข้อมูลที่ type เป็น numberic แต่เรียกให้แสดงใน C# เป็น .text
Code (C#)
strSQL = "SELECT * FROM"+
"("+
"SELECT kpiDesc,COALESCE(performance,0)as performance,MONTH(kpiDate) AS months" +
" FROM table1 LEFT JOIN "+
"table2 ON table1.kpiID = table2e.kpiID"+
" WHERE MONTH(kpiDate) IN(1,2,3,4,5,6,7,8,9,10,11,12)"+
" AND empID = @user"+
" AND kpiRound =2012"+
") as tblpvt"+
" PIVOT (SUM(tblpvt.performance) for tblpvt.months IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) as pvt ORDER BY kpiDesc";
...............................................................................
//*** KPI January ***//
Label lblMonth1 = (Label)(e.Item.FindControl("lblMonth1"));
if (lblMonth1 != null)
{
lblMonth1.Text = (string)DataBinder.Eval(e.Item.DataItem, "[1]");
}
Tag : ASP.NET Ms SQL Server 2008, HTML/CSS, Web (ASP.NET), C#
|
|
 |
 |
 |
 |
Date :
2012-08-20 15:13:18 |
By :
SuSaya |
View :
1035 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |