大家在修改资料的时候用的 formview还是自己划
如题,为什么我不能更新呢
在修改的from里面
protected void Page_Load(object sender, EventArgs e)
{
string connectionigstring = ConfigurationManager.ConnectionStrings[ "sample2con "].ConnectionString;
SqlConnection con = new SqlConnection(connectionigstring);
SqlCommand cmdFind = new SqlCommand( "select * from Members where UserID= 'a ' ", con);
con.Open();
SqlDataReader sdr = cmdFind.ExecuteReader(CommandBehavior.CloseConnection);
while (sdr.Read())
{
this.lblID.Text = sdr[ "UserID "].ToString();
this.tbUserName.Text = sdr[ "UserName "].ToString();
this.ddlPower.Text = sdr[ "UserPower "].ToString();
this.rbUserSex.Text = sdr[ "UserSex "].ToString();
this.tbYear.Text = (Convert.ToDateTime(sdr[ "UserBirthDay "].ToString())).Year.ToString() ;
this.ddlMonth.Text = (Convert.ToDateTime(sdr[ "UserBirthDay "].ToString())).Month.ToString();
this.ddlDay.Text = (Convert.ToDateTime(sdr[ "UserBirthDay "].ToString())).Day.ToString();
this.tbUserEmail.Text = sdr[ "UserEmail "].ToString();
this.tbUserAddress.Text = sdr[ "UserAddress "].ToString();
}
sdr.Close();
}
protected void btnModify_Click(object sender, EventArgs e)
{
string UserName = this.tbUserName.Text;
string UserSex = this.rbUserSex.Text;
string UserPower = this.ddlPower.Text;
string UserBirthDay;
string UserEmail = this.tbUserEmail.Text;
string UserAddress = this.tbUserAddress.Text;