Microsoft KB Archive/151612

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

Article ID: 151612

Article Last Modified on 10/3/2003

-

APPLIES TO


 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q151612





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.

Keywords: kbbug KB151612

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.