Dim sqlstr As String = "insert into file3 (njiao) select count(*)  from [file] where filename like'%完成第七章翻译%'where fid='完成第七章翻译' "哪里错了呢?

解决方案 »

  1.   

    like后面,where前面都要有空格而且你这是两个where啊,不可以的,改成where xxxx and xxxxx ,你基本的sql知识也太差了吧
      

  2.   

    把第二个where改为:andinsert into file3 (njiao) 
      select count(*) from [file] where filename like'%完成第七章翻译%' and fid='完成第七章翻译'
      

  3.   

    恩~教训的是~不过我只是插入njiao列,为什么报错显示不能将空置插入列fid呢?
      

  4.   

    Dim sqlstr As String = "insert into file3 (njiao) select isnull(count(*),0) from [file] where filename like '%完成第七章翻译%' and fid='完成第七章翻译' "
    试试
      

  5.   

    不寫錯誤提示,那可能會有很多地方哦
    (njiao)是數字型么?
      

  6.   

    不能将值 NULL 插入列 'fid',表 'database.dbo.file3';列不允许有空值。INSERT 失败。
    语句已终止。 
      

  7.   


    insert into file3 (njiao) vlaues (select isnull(count(*),0) from [file] where filename like '%完成第七章翻译%' and fid = '完成第七章翻译')不知道对不对 试试吧
      

  8.   


    'vlaues' 附近有语法错误。
      

  9.   

    其实问题就是:
    有两张表file 和 file3 两张表的联系列为filename
    我现在想通过count记录下file的个数,然后将记录下的个数插入到表file3.sql语句要怎么写?
      

  10.   

    因为我的vlause 写错了 应该是 values
      

  11.   


    还是不对。。关键字 'select' 附近有语法错误。
    ')' 附近有语法错误。 
      

  12.   


    select count(*) into file3 from [file] where filename like '%完成第七章翻译%' and fid = '完成第七章翻译'