是textbox里的值不变还是数据库里的值不变

解决方案 »

  1.   

    如果是TextBox里的值不变,可能是你没有刷新数据。
    如果是数据库里的值不变,可能是你没有正确的提交。
    弄清这两个问题,找原因就要容易得多了。
      

  2.   

    付值:
    while(reader1.Read())
    {
    this.TextBox1.Text=reader1.GetString(0)
    }
    保存:
    string strupdate="update Employee_Info set posi=@posi where sysno="+sysno;
    SqlCommand strupdatecmd=new SqlCommand(strupdate,strupdateconn);
    strupdatecmd.Parameters.Add(new SqlParameter("@posi",SqlDbType.NVarChar,30));
    strupdatecmd.Parameters["@posi"].Value=TextBox1.Text;
    strupdatecmd.Connection.Open();
    try
    {
    strupdatecmd.ExecuteNonQuery();
    Response.Write("OK");
    }
    catch
    {
    Response.Write("error"); }
    finally
    {
    strupdatecmd.Connection.Close();
    }strupdatecmd.Parameters["@posi"].Value=TextBox1.Text;
      

  3.   

    你最好将代码贴出吧!
      我猜想,你textbox跟本就没有和数据库链上,因为你数据没有传给服务器端!
      

  4.   

    你的代码中有没有这句:
    if(!IsPostBack)
    {
    sqlDataAdapter1.Fill(dataSet1,"表名");
    DataGrid1.DataBind();
    }
      

  5.   

    你不知道怎么刷新textbox!!
      zag(急弯) 是指页面刷新呀!
      

  6.   

    页面刷新后,TextBox里的值还是数据库里的值啊!