Because your parameter is int type and your textbox give it string typeYou must convert it to int   just like    convert.ToInt16(txtbox.text)

解决方案 »

  1.   

    有没有在web.config里设置
    <globalization requestEncoding="gb2312" responseEncoding="gb2312" />
      

  2.   

    第一位大哥,convert需要的名字空间我不知道。你在看看我的“更新程序“怎么更新不了。(可以运行)万分感谢!!
    ……
    String strSQL="update grade set 学号=@SNO"+"姓名=@SName,GRE=@SGRE where 学号=@SNO";
    SqlCommand cm=new SqlCommand(strSQL,Conn);
    cm.Parameters.Add(new SqlParameter("@SName",SqlDbType.NVarChar,50));
    cm.Parameters.Add(new SqlParameter("@SGRE",SqlDbType.BigInt));
    String colvalue=((TextBox)E.Item.Cells[3].Controls[0]).Text;
    cm.Parameters["@SName"].Value=colvalue;
    colvalue=((TextBox)E.Item.Cells[4].Controls[0]).Text;
    cm.Parameters["@SGRE"].Value=colvalue;
    cm.Parameters.Add(new SqlParameter("@SNO",SqlDbType.BigInt));
    cm.Parameters["@SNO"].Value=myGrade.DataKeys[(int)E.Item.ItemIndex]
    ……
      

  3.   

    sql语句加  '   试试.
      

  4.   

    String strSQL="update grade set 学号=@SNO,姓名=@SName,GRE=@SGRE where 学号=@SNO";   //姓名前加",";