当前位置: 代码迷 >> ASP.NET >> sql语句语法异常
  详细解决方案

sql语句语法异常

热度:2488   发布时间:2013-02-25 00:00:00.0
sql语句语法错误?
Dim sqlstr As String = "insert into file3 (njiao) select count(*) from [file] where filename like'%完成第七章翻译%'where fid='完成第七章翻译' "

哪里错了呢?

------解决方案--------------------------------------------------------
like后面,where前面都要有空格

而且你这是两个where啊,不可以的,改成where xxxx and xxxxx ,你基本的sql知识也太差了吧
------解决方案--------------------------------------------------------
把第二个where改为:and

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

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

不知道对不对 试试吧
  相关解决方案