try to write out the sql and run the sql to see if there is any records affect
private void btnSubmit_Click(object sender, System.EventArgs e)
{
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(".") + "..\\Data\\txl.mdb";
strSelect = "Update friend SET f_name='" + txtName.Text;
            strSelect += "',f_honephone ='" + txtHphone.Text;
strSelect += "',f_mphone ='" + txtMphone.Text;
strSelect += "',f_postalcode ='" + txtPostalcode.Text;
strSelect += "',f_address ='" + txtAddress.Text;
strSelect += "',f_oicp ='" + txtOicq.Text;
strSelect += "',f_email ='" + txteMail.Text;
strSelect += "',f_homepage =" + txtHomePage.Text;
strSelect += ",f_birthday ='" + txtBirthDay.Text;
strSelect += "',f_sex ='" + txtSex.Text;
    strSelect += "',f_intro ='" + txtInTro.Text;     
strSelect += "',f_company ='" + txtCompany.Text;
strSelect += "' where f_id =" + id; Response.Write("***" + strSelect + "***");
conn = new OleDbConnection(strConn);
conn.Open();
comm = new OleDbCommand(strSelect,conn);
int n = comm.ExecuteNonQuery();
conn.Close(); Response.Write(n.ToString() + " records are affected");
}by the way, you might know that the way you are concatenating sql is susceptible to sql injection, you should consider to use parameter approach

解决方案 »

  1.   

    可能 f_id <> id;
      

  2.   

    加个断点,看一下你最后生成的update语句是否有误,就可以了
      

  3.   

    把update语句response.write下,看是不是出了问题
      

  4.   

    Response.Write("***" + strSelect + "***");
    我用这个语句查看了下,原来从数据库里读出来的值都没有改变,所有Text的属性值都没有改变。。
      

  5.   

    呵呵 确实非常危险
    不过对初学者先将就吧
    如果你在那个STR加来加去没有出错的话
    我看问题就在你的 f_id 和 id都是什么数据格式啊?是不是有的是字符 有的是数字啊?另外最好先别用
    comm.ExecuteNonQuery();你试下
    SqlDataReader sdr=comm.ExecuteReader();
    然后探测的读下它 或者强制的读下
    看看有什么错误提示没有?if (sdr.Read())
    {
    }