string id= DataGrid1.DataKeys[e.Item .ItemIndex ].ToString();
string PoliInfPath="select [PoliInfURL] from [PoliInf] where [id]='" + Convert.ToUInt32(id) +"'";在我读取access数据库时提示我“标准表达式中数据类型不匹配”
我的id字段是自动编号!
其它的是字段是文本!
是不是Convert.ToUInt32(id)这句有问题!另外还有一个小问题,在access数据库了有没有像sql server的执行sql语句的地方
这样我就可以看一条SQL语句对错了!

解决方案 »

  1.   

    字符串才用''括起来,数字之类的不用。楼主应该温习一下SQL了
      

  2.   

    我知道了,谢谢,
    发现一个新问题啊:(delete [gongao] where [id] = " + DataGrid1.DataKeys[e.Item.ItemIndex].ToString()语法错误 (操作符丢失) 在查询表达式 '[gongao] where [id] = 2123123126' 中id还是自动编号,其他的是文本!
      

  3.   

    我知道了,谢谢,
    发现一个新问题啊:("delete [gongao] where [id] = " + DataGrid1.DataKeys[e.Item.ItemIndex].ToString()语法错误 (操作符丢失) 在查询表达式 '[gongao] where [id] = 2123123126' 中id还是自动编号,其他的是文本!
      

  4.   

    "delete from [gongao] where [id] = " + DataGrid1.DataKeys[e.Item.ItemIndex].ToString()
      

  5.   

    哦,谢谢你,好用了,可是我不明白为什么
    delete [gongao] where [id] = " + DataGrid1.DataKeys[e.Item.ItemIndex].ToString()
    不好用呢!
    这条语句在SQL的查询分析器里就好使啊!还有
    另外还有一个小问题,在access数据库了有没有像sql server的执行sql语句的地方
    这样我就可以看一条SQL语句对错了!
      

  6.   

    在access数据库了有没有像sql server的执行sql语句的地方
    使用MS Query,office就有带
    access只支持标准的sql与sql server还是有很大区别的
      

  7.   

    学习
    /*-------我的精英团队------*\ http://www.51team.com \*-------寻找团队精英------*/
      

  8.   

    string PoliInfPath="select [PoliInfURL] from [PoliInf] where [id]=" + Convert.ToUInt32(id) +"";