运行VS2008时,出现错误,指出Sqlcon.Open();出现错误,我不太懂。是初学者。
public partial class Edit : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { string StrID = Request["ID"]; string Com = "select * from tb_Vote where ID=✀"+StrID+"✀"; SqlConnection Sqlcon = new SqlConnection(ConfigurationManager.AppSettings["ConStr"]); ——> Sqlcon.Open(); SqlCommand SqlCom = new SqlCommand(Com, Sqlcon); SqlDataReader dr = SqlCom.ExecuteReader(); dr.Read(); if (!IsPostBack) { this.txtSubject.Text = dr["Title"].ToString(); this.txtContent.Text = dr["Content"].ToString().Replace("|", "尀n"); } dr.Close(); }