I'm trying to execute the following valid SQL statement:
strSQL = "SET NOCOUNT ON;" & strInsertQuery & ";" & "SELECT @@IDENTITY AS Ident;"
rs = conn.execute(strSQL)
*strInsertQuery is a valid Insert statement
Nothing too taxing one should imagine. I am simply trying to execute an Insert and have it return the auto number it just generated into the recordset "rs".
When my program gets to the execute line it crashes out with the error: "Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'"
I've tried this various ways, using a command object to execute for instance. The key point it seems, is that it cannot execute if there is more than one SQL command.
Yet, according to a tutorial at I should be able to do this.
I am using an Access 2000 backend. From what I've read, Access 2000 supports multiple statements and @@Identity.
What's wrong?
strSQL = "SET NOCOUNT ON;" & strInsertQuery & ";" & "SELECT @@IDENTITY AS Ident;"
rs = conn.execute(strSQL)
*strInsertQuery is a valid Insert statement
Nothing too taxing one should imagine. I am simply trying to execute an Insert and have it return the auto number it just generated into the recordset "rs".
When my program gets to the execute line it crashes out with the error: "Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'"
I've tried this various ways, using a command object to execute for instance. The key point it seems, is that it cannot execute if there is more than one SQL command.
Yet, according to a tutorial at I should be able to do this.
I am using an Access 2000 backend. From what I've read, Access 2000 supports multiple statements and @@Identity.
What's wrong?