日期:2014-05-17 浏览次数:21225 次
string connStr = "server=localhost;database=seis_project;uid=seisprjs;pwd=seisprjs";
SqlConnection myConn = new SqlConnection(connStr);
string selStr = "select 帐号,count(帐号) as 次数 from pub_log_read group by 帐号 order by 帐号 desc";
SqlCommand myCmd = myConn.CreateCommand();
myCmd.CommandText = selStr;
myConn.Open();
SqlDataReader sdr = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
// Since the reader implements and IEnumerable, pass the reader directly into
// the DataBindTable method with the name of the Column to be used as the XValue
Chart1.Series[0].Points.DataBindXY(sdr, "帐号",sdr,"次数");
sdr.Close();
myConn.Close();