预期结束语句错误

时间:2012-12-05 00:24:49

标签: sql select vbscript

我有一个正在第三方应用程序中运行的VB脚本,并且正在抛出“预期的语句结束”错误。这是有问题的代码。选择的语句在SQL server manager studio中正常工作。

感谢。

Dim SecurityDB
Set SecurityDB = CreateObject("ADODB.Connection")
Conn = "DRIVER={SQL Server};SERVER=ustcca015s6\Continuum;DATABASE=continuumdb;UID=Andy8796;PWD=xxxx1234;"
SecurityDB.Open Conn
Set EmployeeRS = SecurityDB.Execute "Select count(*) from dbo.personnel where state=1 and lastname not like 'lapt%' and lastname is not NULL and valuelo in (Select ObjectIdLo from area where uiname like 'usmm%' and uiname not like '%gate%') and valuelo <> 1111497912;"
Result = EmployeeRS.GetRows
EmployeeRS.Close
SecurityDB.Close

1 个答案:

答案 0 :(得分:1)

两周前@RichardTheKiwi在评论部分发布了答案,但遗憾的是还没有在答案部分添加答案。好吧,Point Pimp [ette]今晚回来了,所以这些问题显示为更接近“解决”了一步!

执行后不需要括号吗?

Set EmployeeRS = SecurityDB.Execute("Select count(*) from dbo.personnel where state=1 and lastname not like 'lapt%' and lastname is not NULL and valuelo in (Select ObjectIdLo from area where uiname like 'usmm%' and uiname not like '%gate%') and valuelo <> 1111497912;")