Difference between revisions of "Microsoft KB Archive/103976"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
Line 44: Line 44:
 
== SYMPTOMS ==
 
== 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.
+
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.
  
 
</div>
 
</div>
Line 56: Line 56:
 
<ul>
 
<ul>
 
<li><p>Use the ExecuteSQL. Its default is DB_SQLPASSTHROUGH:</p>
 
<li><p>Use the ExecuteSQL. Its default is DB_SQLPASSTHROUGH:</p>
<pre class="codesample">      i = db.ExecuteSQL(&quot;action statement&quot;)
+
<pre class="codesample">      i = db.ExecuteSQL("action statement")
 
                         </pre></li>
 
                         </pre></li>
 
<li><p>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:</p>
 
<li><p>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:</p>
 
<pre class="codesample">      Dim ds As Dynaset
 
<pre class="codesample">      Dim ds As Dynaset
       Set ds = db.CreateDynaset(&quot;action statement&quot;, SQL_PASSTHROUGH)
+
       Set ds = db.CreateDynaset("action statement", SQL_PASSTHROUGH)
 
       ds.Close
 
       ds.Close
 
                         </pre>
 
                         </pre>
 
<p>If you are using the data control, specify datacontrol.Database as the database variable as in this example:</p>
 
<p>If you are using the data control, specify datacontrol.Database as the database variable as in this example:</p>
 
<pre class="codesample">      ' Enter the following two lines as one, single line:
 
<pre class="codesample">      ' Enter the following two lines as one, single line:
       Set ds = Data1.Database.CreateDynaset(&quot;action statement&quot;,
+
       Set ds = Data1.Database.CreateDynaset("action statement",
 
         SQL_PASSTHROUGH)
 
         SQL_PASSTHROUGH)
 
                         </pre></li></ul>
 
                         </pre></li></ul>
Line 84: Line 84:
 
=== Steps to Reproduce Problem ===
 
=== Steps to Reproduce Problem ===
  
The following program results in the incorrect &quot;Invalid argument&quot; error.
+
The following program results in the incorrect "Invalid argument" error.
 
<pre class="codesample">  Const DB_SQLPASSTHROUGH = &amp;H40
 
<pre class="codesample">  Const DB_SQLPASSTHROUGH = &amp;H40
 
   Dim db As Database
 
   Dim db As Database
   Set db = OpenDatabase(&quot;&quot;, False, False, &quot;ODBC&quot;)
+
   Set db = OpenDatabase("", False, False, "ODBC")
   db.Execute &quot;action statement&quot;, DB_SQLPASSTHROUGH
+
   db.Execute "action statement", DB_SQLPASSTHROUGH
 
                 </pre>
 
                 </pre>
  

Revision as of 09:31, 20 July 2020

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