GridView无法显示
protected void Page_Load(object sender, EventArgs e){
if (!Page.IsPostBack)
{
SqlDataReader MyReader;
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = (@"Data Source=RGYJ-AVTYN682XD;Initial Catalog=库;User ID=sa;Password=sa123456789");
SqlCommand MyCommand = new SqlCommand();
= "SELECT * FROM 销售";
= CommandType.Text;
MyCommand.Connection = MyConnection;
MyCommand.Connection.Open();
//Response.Write("连接成功");
MyReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection);
GridView1.DataSource = MyReader;
GridView1.DataBind();
}
}
运行以后为什么 GridView控件部分显示是空白 求解释