日期:2014-05-17  浏览次数:20507 次

各位朋友 帮忙看段代码,
数据访问层代码:
  /// <summary>
  /// 修改企业介绍信息
  /// </summary>
  /// <param name="infoNote">更新的企业信息介绍</param>
  /// <param name="id">给那一条企业信息修改</param>
  /// <returns></returns>
  public bool Update_jieshao(string infoNote,int id)
  {
  string sqlStr = "update jieshao set InfoNote=@InfoNote where InfoID=@ID";
  OleDbCommand cmd = new OleDbCommand(sqlStr, con);
  OleDbParameter par1 = new OleDbParameter("@InfoNote",OleDbType.VarChar);
  OleDbParameter par2 = new OleDbParameter("@InfoID", OleDbType.Integer);
  par1.Value = infoNote;
  par2.Value = id;
  cmd.Parameters.Add(par1);
  cmd.Parameters.Add(par2);
  con.Open();
  if (cmd.ExecuteNonQuery()>0)
  {
  return true;
  }
  return false;
  }
  }

业务逻辑层;
  /// <summary>
  /// 修改企业介绍信息
  /// </summary>
  /// <param name="infoNote">更新的企业信息介绍</param>
  /// <param name="id">给那一条企业信息修改</param>
  /// <returns></returns>
  public bool Update_jieshao(string infoNote, int id)
  {
  return jsManager.Update_jieshao(infoNote, id);
  }

UI层:
  int id;
  jieshaoService jsService = new jieshaoService();
  protected void Page_Load(object sender, EventArgs e)
  {
  if (Session["user"] == null)
  {
  Response.Redirect("~/manage/login.aspx");
  }
   
  List<jieshao> list = jsService.Get_jieshao();
  this.cdkJieShao.Text = list[0].InfoNote;
  id = list[0].InfoID;
   

  }
//点击修改按钮
  protected void btnSubmit_Click(object sender, EventArgs e)
  {
  //int infoid = Convert.ToInt32(((Button)sender).CommandArgument);
  string infoNote = this.cdkJieShao.Text;
  if (jsService.Update_jieshao(infoNote, id))
  {
  Page.ClientScript.RegisterClientScriptBlock(typeof(string), "", "<script>alert('修改成功!')</script>");
  }
  else
  {
  Page.ClientScript.RegisterClientScriptBlock(typeof(string), "", "<script>alert('修改失败!!')</script>");
  }
  }

------解决方案--------------------
加Q 764537152 可以帮忙看下。