本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
出现如下错误,如何解决???
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO; //提供用于向文件读写数据的类(本程序要用到删除文件)
public partial class Default2 : System.Web.UI.Page
{
public static DataSet ds1 = null; //将数据集 ds1 为全局变量
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn1 = new SqlConnection("data source=(local);database=****;user=****; password=********"); //创建连接对象,并指明要连接的数据库名称、用户名、用户密码
SqlDataAdapter da1 = new SqlDataAdapter(); //创建数据适配器
DataSet ds1 = new DataSet(); //创建DataSet(数据集)
//适配器对象的查询命令
SqlCommand cmdSel = new SqlCommand("select ID,MYDATE,WJLX,WJLJ from baobiao", conn1); //创建DataAdapter(数据适配器)
da1.SelectCommand = cmdSel;
da1.Fill(ds1, "baobiao"); //使用数据适配器填充数据集
GridView2.DataSource = ds1.Tables["baobiao"]; //指定数据源
GridView2.DataBind(); //绑定、显示数据
}
protected void GridView2_Sorting(object sender, GridViewSortEventArgs e)
{
GridView2.Sort("WJLX", SortDirection.Ascending);//按WJLX字段进行排序
GridView2.DataSource = ds1.Tables["baobiao"];
GridView2.DataBind();
}
}