读书人

sql语句语法异常

发布时间: 2012-04-16 16:20:04 作者: rapoo

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 = '完成第七章翻译')

不知道对不对 试试吧

读书人网 >asp.net

热点推荐