BUG: sp_OAMethod Does Not Connect If Parameter Is a NULL Value

Last reviewed: April 8, 1997
Article ID: Q151612

The information in this article applies to:
  • Microsoft SQL Server, version 6.5

SYMPTOMS

The sample in SQL Server Books Online shows how to make a standard security connection. However, if you attempt to pass a NULL value as the password or server name, the connection will fail and the following message appears:

   Bad variable type

CAUSE

The sp_OAMethod stored procedure is not properly handling NULL values.

WORKAROUND

To correctly complete the sample, you must have a password and server name, or you can make an integrated connection.

The following modification makes an integrated connection:

-- Set the property EXEC @hr = sp_OASetProperty @object, 'LoginSecure', 1 IF @hr <> 0

    EXEC sp_OAGetErrorInfo @object

-- Call the method to connect EXEC @hr = sp_OAMethod @object, 'Connect', NULL IF @hr <> 0
    EXEC sp_OAGetErrorInfo @object

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words:
Keywords : kbbug6.50
Version : 6.5
Platform : WINDOWS


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: April 8, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.