我想更新这些Textbox里面的数据,请高手看下我的代码对吗,总修改失败?不知道为什么?
zknnn 2009-04-08 06:52:54 protected void btn_Update_Click(object sender, EventArgs e)
{
string teaName = this.tb_name.Text.Trim();
string Sex = this.Sex.Text.Trim();
string Birthday1 = this.year.SelectedItem.Text.Trim();
string Birthday2 = this.month.SelectedItem.Text.Trim();
string Birthday3 = this.day.SelectedItem.Text.Trim();
string Country = this.Country.SelectedItem.Text.Trim();
string Hometown = this.Hometown.SelectedItem.Text.Trim();
string Identification = this.Identification.Text.Trim();
string idStype = this.idStype.SelectedItem.Text.Trim();
string WorkYears = this.WorkYears.SelectedItem.Text.Trim();
string HomeAddr1 = this.HomeAddr1.SelectedItem.Text.Trim();
string HomeAddr2 = this.HomeAddr2.SelectedItem.Text.Trim();
string telephone1 = this.telephone1.Text.Trim();
string telephone2 = this.telephone2.Text.Trim();
string telephone3 = this.telephone3.Text.Trim();
string companyTel1 = this.companyTel1.Text.Trim();
string companyTel2 = this.companyTel2.Text.Trim();
string companyTel3 = this.companyTel3.Text.Trim();
string companyTel4 = this.companyTel4.Text.Trim();
string Mobile1 = this.Mobile1.Text.Trim();
string Mobile2 = this.Mobile2.Text.Trim();
string Email = this.Email.Text.Trim();
string address = this.address.Text.Trim();
string postNumber = this.postNumber.Text.Trim();
string personalPage = this.personalPage.Text.Trim();
string qq = this.qq.Text.Trim();
string msn = this.msn.Text.Trim();
Birthday1 = Birthday1 + Birthday2 + Birthday3;
HomeAddr1 = HomeAddr1 + HomeAddr2;
telephone1 = telephone1 + telephone2 + telephone3;
companyTel1 = companyTel1 + companyTel2 + companyTel3 + companyTel4;
Mobile1 = Mobile1 + Mobile2;
string sql = "update t_basePersonInfo set teaName='" + teaName + "',Sex='" + Sex + "',Birthday='" + Birthday1 + "',Country='" + Country + "',Hometown='" + Hometown + "',Identification='" + Identification + "',idStype='" + idStype + "',WorkYears='" + WorkYears + "',HomeAddr1='" + HomeAddr1 + "',telephone1='+telephone1+',companyTel1='" + companyTel1 + "',Mobile1='" + Mobile1 + "',Email='" + Email + "',address='" + address + "',postNumber='" + postNumber + "',personalPage='" + personalPage + "',qq='" + qq + "',msn='" + msn + "' where ID='"+Session["ID"].ToString()+"'";
operatorDB odb = new operatorDB();
try
{
odb.exeNonQuery(sql);
Response.Write("<script language=javascript>alert('个人信息修改成功!')</script>");
}
catch
{
Response.Write("<script language=javascript>alert('个人信息修改失败!')</script>");
}