sql = "update [classcenter] set [address] = '" + e.Item.Cells(3).Text + "', [tel] = '" + e.Item.Cells(4).Text + " ', [bus] = '" + e.Item.Cells(5).Text + "' where id=" & e.Item.Cells(2).Texte.Item.Cells(2).Text 这个是字符串类型怎么转换成int
用VB.NET
Ctype()
Cint
都转不了。请教高人

解决方案 »

  1.   

    Convert.ToInt32( e.Item.Cells(2).Text)
      

  2.   

    而且我觉得你在你的sql字符串中没有必要转为int。
      

  3.   

    在程序中组成SQL语句, 一般的字符串类型,比如: str = "66";传给SQL时,SQL语法会当整型处理;
    另外,比如: str = "'" + "66" + "'" ,传给SQL时,它才当作SQL语法的字符串处理.
      

  4.   

    to lazyfish
    输入的格式不正确在SQL中是numeric类型,在.NET中对应什么类型。还是无法解决。
      

  5.   

    where id="' & e.Item.Cells(2).Text'""
    试试.
      

  6.   

    改为:
    where id="' & e.Item.Cells(2).Text &'""