这是更新事件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;
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;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货