FIX: Invalid Argument Err on Execute Method w/ SQL Passthrough

Last reviewed: October 30, 1997
Article ID: Q103976
3.00 WINDOWS kbinterop kbprg kbbuglist

The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows, version 3.0

SYMPTOMS

When you open a database using ODBC and use the Execute method of the Database object or property with the SQL passthrough option (value 64) specified, the error "Invalid argument" (number 3001) incorrectly occurs.

WORKAROUND

Here are two possible workarounds. Use either one.

  • Use the ExecuteSQL. Its default is DB_SQLPASSTHROUGH:

          i = db.ExecuteSQL("action statement")
    
  • Use CreateDynaset or CreateSnapshot with the SQL passthrough option to execute an SQL action statement. Then close the resulting recordset object immediately. Here's an example:

          Dim ds As Dynaset
          Set ds = db.CreateDynaset("action statement", SQL_PASSTHROUGH)
          ds.Close
    

    If you are using the data control, specify datacontrol.Database as the database variable as in this example:

          ' Enter the following two lines as one, single line:
          Set ds = Data1.Database.CreateDynaset("action statement",
    
             SQL_PASSTHROUGH)
    
    

STATUS

Microsoft has confirmed this to be a bug in the products listed above. This problem was fixed in the Compatibility Layer (COMLYR.EXE) update.

MORE INFORMATION

Steps to Reproduce Problem

The following program results in the incorrect "Invalid argument" error.

   Const DB_SQLPASSTHROUGH = &H40
   Dim db As Database
   Set db = OpenDatabase("", False, False, "ODBC")
   db.Execute "action statement", DB_SQLPASSTHROUGH


Additional reference words: 3.00 buglist3.00 fixlist3.00
KBCategory: kbinterop kbprg kbbuglist
KBSubcategory: APrgDataODBC
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.