[问题] [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