DB.LOGON Required Before DB.SQL.QUERY To A SQL Server

Last reviewed: November 4, 1994
Article ID: Q85574
Summary:

When using the DB.Functions provided by QE.XLA to query an SQL Server table, it is necessary to use DB.LOGON("SQLServer") prior to sending the DB.SQL.QUERY() command. Otherwise, the DB.SQL.QUERY statement will fail and the result of the DB.SQL.QUERY will be a #REF!.

More Information:

The DB.SQL.QUERY command in the QE.XLA tests what sources are available before allowing the query. If the source in the query is not available, the macro fails and returns a #REF!.

Steps to Reproduce Problem

  1. In Excel, open a new macro sheet. Enter the following:

          =DB.SQL.QUERY(2,"use pubs; Select * from SQLServer | sales")
    

  2. Change to a worksheet and execute the macro. Nothing will be returned.

  3. Add "=DB.LOGON("SQLServer")" (without quotation marks) before the DB.SQL.QUERY command.

  4. Again, execute the macro. This time, after correctly logging on to the SQL Server, information will be returned.

Reference(s):

"Q+E for Microsoft Excel User's Guide," pages 69-72


KBCategory: kbother
KBSubcategory:

Additional reference words: 3.0 3.0a 3.00 3.00a


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: November 4, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.