I've just created a query which involves a selection on a table created by the WITH statement; I'd like to run in on a Visual Basic 6 application (connected to the database by an ADODB object) but I got an error message "incorrect syntax near the keyword "WITH", when I use the open method of a ADODB.recordset Object; it's like Visual Basic 6 doesn't understand this statement. How could I fix this? Is there an alternative way to perform the sql's WITH statement on Visual Basic 6?
Asked
Active
Viewed 788 times
-1
-
7You're going to have to share a lot more details with us: code, SQL statement and specifics of the error. – Jay Riggs Jul 11 '11 at 16:04
-
2VB6 does not compile SQL anyway, so this question is simply "blaming the tool" and missing the target. – Bob77 Jul 11 '11 at 16:23
-
The problem is with your SQL-statement and/or the database engine you use. VB6 only provides the envelope for these and is ignorant of database code. – Dabblernl Jul 11 '11 at 17:50
-
I get the error "incorrect syntax near the keyword "WITH", when I use the open method of a ADODB.recordset Object – Dharma Dude Jul 11 '11 at 17:55
-
@Dharma - please show your code. – Daniel A. White Jul 11 '11 at 18:15
1 Answers
2
A pound for a penny (in the absence of any more information and most likely incompleete error message) that the WITH does not have a preceeding ;
because of a SET statement or DECLARE or some such.
Incorrect syntax near the keyword 'with'...previous statement must be terminated with a semicolon
Or OP is using SQL Server 2000 still...
-
Indeed I just put the semicolon, but I got another error: "Incorrect syntax near 'tmp'; the query starts with: ";WITH tmp (id_area_possesso,id_area_utente,livello_accesso) AS (" – Dharma Dude Jul 11 '11 at 18:39