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
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
解决方案 »
- IIS集成windows身份验证 HTTP 401.3错误
- 用户控件包含DataList控件,在引用页面后台如何修改其模板?
- 从数据库读取数据绑定到树控件上怎么做..?
- 特殊字符控制解决方案讨论
- asp2.0中从数据库中递归读取节点填充treeview的问题
- IndexOf("?") 请问下面的代码是什么意思??高手请进来
- 求助关于RegularExpressionValidator的验证表达式
- 求大家帮个忙,谢
- 操作域用户的问题,杨云的这个类具体该如何使用?请大虾出来帮帮忙!
- 数字分页加页面跳转
- 我电脑先前装了vs.net2002,现在想装vs.net2003,能不能不卸原来的直接装2003
- 图片 onload事件有时能设大小,有时不能的问题
我用这个语句查看了下,原来从数据库里读出来的值都没有改变,所有Text的属性值都没有改变。。
不过对初学者先将就吧
如果你在那个STR加来加去没有出错的话
我看问题就在你的 f_id 和 id都是什么数据格式啊?是不是有的是字符 有的是数字啊?另外最好先别用
comm.ExecuteNonQuery();你试下
SqlDataReader sdr=comm.ExecuteReader();
然后探测的读下它 或者强制的读下
看看有什么错误提示没有?if (sdr.Read())
{
}