Microsoft KB Archive/103976

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 15:03, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Article ID: 103976

Article Last Modified on 1/9/2003



APPLIES TO

  • Microsoft Visual Basic 3.0 Professional Edition



This article was previously published under Q103976

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 query words: 3.00 buglist3.00 fixlist3.00

Keywords: kbbug kbfix KB103976