1

我有这个在 3rd 方应用程序中运行的 VB 脚本,并抛出“预期语句结束”错误。这是有问题的代码。选择语句在 SQL 服务器管理器工作室中运行良好。

谢谢。

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
4

1 回答 1

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;")
于 2012-12-19T07:49:09.930 回答