把Price的单引号去掉试试SqlCommand Updatecmd=new SqlCommand("update prices set sPrice='"+Price+"' where sID='"+ID+"'",Updatecon); //数据表名prices 价格
改成
SqlCommand Updatecmd=new SqlCommand("update prices set sPrice="+Price+" where sID='"+ID+"'",Updatecon); //数据表名prices 价格
改成
SqlCommand Updatecmd=new SqlCommand("update prices set sPrice="+Price+" where sID='"+ID+"'",Updatecon); //数据表名prices 价格
SqlCommand Updatecmd=new SqlCommand(sql,Updatecon);
Decimal Price=Convert.ToDecimal(((TextBox)(e.Item.Cells[3].Controls[1])).Text.Trim());
晕了..还是谢谢楼上的朋友^^
decimal Price=decimal.Parse(TextBox1.Text.Trim());
按照这个流程来,应该没问题。
改成
SqlCommand Updatecmd=new SqlCommand("update prices set sPrice="+Price+" where sID="+ID+"",Updatecon); //数据表名prices 价格 int 类型的不要用 ' 符号,呵
decimal Price=decimal.Parse(TextBox1.Text.Trim()); 要和数据库里的字段相对应!!!!!!!!!!!!!!!!!!!!!!!!!!1
把这个放sql看能运行通过不~