[問題] [c#]請問若從sql server撈資料並以此繪圖

作者: dragonknife (珍 惜)   2014-05-20 17:07:05
想產生的是類似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);
}

Links booklink

Contact Us: admin [ a t ] ucptt.com