网页启动后,通过读取SQL数据库得到数据资料后绑定到相关的图表控件中,整个过程需要20秒左右,有什么办法可以加快速度?
主要代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
show_Fcst_Real_chart();
C1GridView1.DataSource = BindGrid();
C1GridView1.DataBind();
C1GridView2.DataSource = FR_BindGrid);
C1GridView2.DataBind();
C1GridView3.DataSource = Wind_BindGrid();
C1GridView3.DataBind();
}
数据库绑定代码:
public DataSet BindGrid()
{
SqlConnection con = new SqlConnection("data source=" + source + " ;initial catalog= " + database + " ;user id= " + user + " ;password=" + password);
SqlDataAdapter da;
DataSet ds = new DataSet();
string strsql2 = "SELECT SIDToPublishing.Publishing_unit, STID_Name.Name from city";
da = new SqlDataAdapter(strsql2, con);
da.Fill(ds);
return ds;
}
|