XL: TypeNum 3 Not Supported By Most ODBC Data Sources

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


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 professionals 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/overview/overview.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:
Q163435 VBA: Programming Resources for Visual Basic for Applications

Additional query words: XL5 XL7 XL97 disabled dimmed

Keywords : kbprg kbdta kbdtacode ODBCGen KbVBA
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c,7.0,7.0a,97; winnt:5.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbhowto


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.