XL: TypeNum 3 Not Supported By Most ODBC Data Sources

Last reviewed: February 3, 1998
Article ID: Q129901
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel 98 for Macintosh

SUMMARY

When you use the SQLGetSchema function with a value of 3 for the TypeNum argument, information will be returned only for certain open database connectivity (ODBC) databases.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/default.asp

SQLGetSchema, a function included in the XLODBC.XLA add-in, is used to return information about the structure of the data source on a particular connection. TypeNum, one of the arguments of SQLGetSchema, is used to specify the type of information you want returned about the data source. The syntax for this function is:

   SQLGetSchema(ConnectionNum, TypeNum, QualifierText)

Using a value of 3 for the TypeNum argument returns a list of owners in a database on the current connection. Owner lists can be generated only with the following ODBC database drivers:

   Microsoft SQL Server, version 4.2x and later
   Oracle, versions 6.0 and 7.0
   Sybase SQL Server (contact Sybase Corporation technical support for a
   list of supported versions)

To find out whether or not a data source can support a list of database owners, connect to the data source with Microsoft Query. In the Add Table dialog box, there is an Owners drop-down list box. If this drop-down list box is unavailable, then the driver does not support the use of Owners.

Below is an example using the SQLGetSchema function to return a list of database owners.

Sample Visual Basic Procedure

   Sub GetOwnerList()
      ' Open a communication channel to the database.
      chan = SQLOpen("DSN=My SQL Server Database")

      ' Get Owner list for the MyDB database.
      OwnerList = SQLGetSchema(chan, 3, "MyDB")

      ' Loop through the owner list and display the values.
      For Each OwnerName In OwnerList
         MsgBox OwnerName
      Next

      ' Close the communication channel.
      SQLClose chan
   End Sub

REFERENCES

For more information about SQLGetSchema, click the Search button in Visual Basic Reference Help and type:

   sqlgetschema

For additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q163435
   TITLE     : VBA: Programming Resources for Visual Basic for
               Applications


Additional query words: XL5 XL7 XL97 disabled dimmed
Keywords : kbcode kbprg ODBCGen
Version : WINDOWS:5.0,5.0c,7.0,7.0a,97; MACINTOSH:5.0,5.0a,98
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


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