2012-12-05 3 views
1

타사 응용 프로그램 내에서 실행되는이 VB 스크립트가 있는데 "Expected End of Statement"오류가 발생합니다. 다음은 문제의 코드입니다 .Select Server는 SQL Server 관리자에서 올바르게 작동합니다 스튜디오.성명 오류의 예상 끝

감사합니다.

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 
+5

실행 후 브래킷이 필요하지 않습니까? '설정 EmployeeRS = SecurityDB.Execute ("선택 카운트 (*) dbo.personnel 상태에서 1과 lastname은 'lapt %'과 같지 않고 lastname은 NULL이 아니며 valuelo에서 ('usmm %'와 같은 uiname이있는 영역에서 ObjectIdLo를 선택하십시오. '% gate %'와 같지 않음)와 valuelo <> 1111497912; ")' – RichardTheKiwi

+0

@RichardTheKiwi의 의견은 정확합니다.'sub' (반환 값을 반환하지 않는 루틴) 만 괄호없이 호출 할 수 있습니다. 'function'을 호출하면 괄호는 필수입니다. 'MsgBox '프로세스 종료,'vbOKOnly'와'answer = MsgBox ("프로세스를 종료 하시겠습니까?", vbYesNo)의 차이점을 확인하십시오. – AutomatedChaos

+1

@RichardTheKiwi : 답변으로 게시하지 않으시겠습니까? – Helen

답변

1

@RichardTheKiwi는 2 주 전 코멘트 섹션에서 답을 기록하지만 슬프게도 ... 대답 섹션을 참조하십시오. 확인, 포인트 포주에 대한 답변으로 추가하지 않았습니다 [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;")