数据库更新成功,但是数据没有改变
用的是sqldatasource
<asp:SqlDataSource ID= "SqlDataSource1 " runat= "server " ConnectionString= " <%$ ConnectionStrings:EBusinessConnectionString %> "
OnUpdated= "SqlDataSource1_Updated " ProviderName= " <%$ ConnectionStrings:EBusinessConnectionString.ProviderName %> "
UpdateCommand= "UPDATE Categories SET name =@newname where category_id=@newcategory_id; ">
<UpdateParameters>
<asp:ControlParameter ControlID= "name " Name= "newname " PropertyName= "Text " />
<asp:SessionParameter Name= "newcategory_id " SessionField= "category_id " />
</UpdateParameters>
</asp:SqlDataSource>
后台代码:
public partial class Admin_categories_edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
name.Text = Session[ "name "].ToString().Trim();
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect( "categories_mgr.aspx ");
}
protected void SqlDataSource1_Updated(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.AffectedRows > 0)
{
// Perform any additional processing, such as sending an e-mail notification.
Label1.Text = Request.LogonUserIdentity.Name +
" changed user information sucessfully! ";
}
else
{
Label1.Text = "No data updated! ";
}
}
protected void Button1_Click(object sender, EventArgs e)
&n