The information in this article applies to:
- Enterprise Edition of Microsoft Visual Basic, 32-bit only,
for Windows, version 4.0
SYMPTOMS
If you attempt to access a non-existent rdoPreparedStatement, the error you
receive depends on whether there are other rdoPreparedStatements in the
collection.
If there are none, you will get error:
40054 - invalid parameter.
If there is at least one, you will get the error:
40041: Couldn't find object indicated by text.
WORKAROUND
To minimize the impact of this problem, ensure that any error handlers that
may trap the above errors perform the same code for both errors.
STATUS
Microsoft has confirmed this to be an issue in the Microsoft products
listed at the beginning of this article. Microsoft is researching this
problem and will post new information here in the Microsoft Knowledge Base
as it becomes available.
MORE INFORMATION
Steps To Reproduce Problem
- Create a DSN in the 32-Bit ODBC section of the Control Panel. Give it
the name "pubs" and configure it to point to the pubs database on a
Microsoft SQL server.
- Start the 32-bit edition of Visual Basic version 4.0 for Windows. Form1
is created by default.
- Add two Command buttons to the form.
- Add the following code to the General Declarations section of Form1:
Option Explicit
Private Sub Command1_Click()
Dim rdocon As rdoConnection
Dim rdoprep As rdoPreparedStatement
Set rdocon = rdoEngine(0).OpenConnection("pubs", False, _
False, "uid=;pwd=;")
Set rdoprep = rdocon.rdoPreparedStatements("Test1")
End Sub
Private Sub Command2_Click()
Dim rdocon As rdoConnection
Dim rdoprep As rdoPreparedStatement
Set rdocon = rdoEngine(0).OpenConnection("pubs", False, _
False, "uid=;pwd=;")
Set rdoprep = rdocon.CreatePreparedStatement("Test", _
"Select * from Authors")
Set rdoprep = rdocon.rdoPreparedStatements("Test1")
End Sub
- Press the F5 key or click Start on the Run menu to run the application.
Click Command1, and you should see that Visual Basic gives the error
below: (At this point the prepared statement has not been created.)
40054 - invalid parameter.
- Stop Visual Basic by using Stop on the Run Menu. Press the F5 key or
click the Run menu again. Click the second button. This time the
error will be different as the code has created a prepared statement:
40041: Couldn't find object indicated by text.
REFERENCES
Visual Basic OnLine Help CreatePreparedStatement,rdoPreparedStatements.
Building Client/Server Applications with Visual Basic Manual, Chapter 8.