作者dragonknife (珍 惜)
看板Programming
标题[问题] [c#]请问若从sql server捞资料并以此绘图
时间Tue May 20 17:07:05 2014
想产生的是类似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://webptt.com/cn.aspx?n=bbs/Programming/M.1400576827.A.FD1.html