Microsoft KB Archive/103976: Difference between revisions
(importing KB archive) |
m (Text replacement - "&" to "&") |
||
(One intermediate revision by the same user not shown) | |||
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 | 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( | <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( | 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( | 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 | The following program results in the incorrect "Invalid argument" error. | ||
<pre class="codesample"> Const DB_SQLPASSTHROUGH = & | <pre class="codesample"> Const DB_SQLPASSTHROUGH = &H40 | ||
Dim db As Database | Dim db As Database | ||
Set db = OpenDatabase( | Set db = OpenDatabase("", False, False, "ODBC") | ||
db.Execute | db.Execute "action statement", DB_SQLPASSTHROUGH | ||
</pre> | </pre> | ||
Latest revision as of 11:24, 21 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