为啥我这行代码,在detailsview中无法显示数据??
if (!this.IsPostBack)
{
if (Request.QueryString["id"] != null)
{
string id = Request.QueryString["id"].ToString();
String strConnection = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection myConnection = new SqlConnection(strConnection);
myConnection.Open();
SqlCommand cmd = new SqlCommand("select wenti from classdata11 where id=+'" + id + "'", myConnection);
this.Label1.Text = Convert.ToString(cmd.ExecuteScalar());
cmd.CommandText = "select * from classdata11 where id='" + id + "'";
SqlDataReader sdr = cmd.ExecuteReader();
this.DetailsView1.DataSource = sdr;
this.DetailsView1.DataBind();
}