彩虹岛力量之证什么用:有关asp.net datagrid更新按钮的问题

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 21:07:20
这是更新事件updatecommand的源码,但是不知道为什么编辑完后点更新数据还是一样的,用断点调试,发现参数的值没有变化
string ProductID=dtg1.DataKeys[e.Item.ItemIndex].ToString ();
string newname=((TextBox)(e.Item .Cells [0].Controls [0])).Text ;
string newon=((TextBox)(e.Item .Cells [2].Controls [0])).Text ;
string str1="update Products set ProductName='"+newname+"',UnitsOnOrder='"+newon
+"'where ProductID="+ProductID;