sqlstr:='select ComData,Name from Commands'+Getchar(combobox1.text)+' where type='+''''+str+'''';
str是一个字符串

解决方案 »

  1.   

    将sqlstr显示出来看看
    给出出错信息
    怀疑是name有问题
      

  2.   

    就是+''''+str+''''这一段报错;
      

  3.   

    sqlstr:='select ComData,Name from Commands'+Getchar(combobox1.text)
    +' where type='+''''+str+'''';把加号放到句首
      

  4.   

    sqlstr:='select ComData,Name from CommandR001 where type=''C001''';
    这是原本要求的语句;
      

  5.   

    sqlstr:='select ComData,Name from Commands'+Getchar(combobox1.text)+' where type='''+str+'''';//type='+'''+str+''''
      

  6.   

    sqlstr:='select ComData,Name from Commands'+Getchar(combobox1.text)+' where type='+''''+str+'''';在字符串换行的时候不要将字符串的内容进行换行,否则将出错
      

  7.   

    str 是 string的呀
    前面几位的试过了,不起作用呢
      

  8.   

    跟踪一下sqlstr的值,看看到底是什么
      

  9.   

    showmessage(sqlstr)看看传递的SQL是否正确....查询无结果的原因有很多
      

  10.   

    renzhm(戴尔飞) 这个兄弟说得对,你写错了
      

  11.   

    不好意思,其实这个语句是对的,就是我在取str的值时是空的。
    每人加2分