[問題] [c#]請問若從sql server撈資料並以此繪圖
想產生的是類似progressba的橫式進度圖
該選用甚麼控制項呢
小弟ˇ目前選用chart 但是databind不出來 不知該怎麼寫
以下附上程式碼
DataSet dataset = new DataSet();
string strSQL = "SELECT (SELECT COUNT(*) FROM ProjSubTasks PSJ
JOIN PROJTASKS PJ ON PJ.TASKID=PSJ.TASKID WHERE PJ.TASKID=1 )as total,
(select count(TaskClosed) from projsubtasks where taskclosed=1)
as closed FROM ProjSubTasks group by taskid";
GetData(strSQL, "ProjSubTasks");
chart1.DataSource = dataset.Tables["ProjSubTasks"];
chart1.DataBind();
private void GetData(string commandstring, string tablename)
{
string connectionstring = @"****************************"
SqlConnection connection = new SqlConnection(connectionstring);
SqlCommand command = new SqlCommand(commandstring, connection);
DataTable table = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataset, tablename);
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.255.79
※ 文章網址: http://www.ptt.cc/bbs/Programming/M.1400576827.A.FD1.html
Programming 近期熱門文章
PTT數位生活區 即時熱門文章