[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


SqlConnection.GetSchema Problems

Posted on 2014-08-07
Medium Priority
Last Modified: 2014-08-07
I cant get the SqlConnection.GetSchema to work with indexes.

        Dim restrictions(3) As String
        restrictions(2) = IdxName

        dbTbl = conn.GetSchema("Indexes", restrictions)
        If dbTbl.Rows.Count = 0 Then
            IdxExist = False
            IdxExist = True
        End If

I always get back 0 rows, even though there is an index. A similar routine works with Tables.

Also, the Microsoft webpage says Indexes schema has 6 restrictions. When I pass an array of 6 restrictions, I get an exception saying too many restrictions were passed. I want to pass the table name as one of the restrictions but it is restriction number 6.

What am I missing?
Question by:MikeBroderick
  • 2

Author Comment

ID: 40246249
I forgot to specify the web page defining the number of restrictions:


Accepted Solution

MikeBroderick earned 0 total points
ID: 40247388
I found the answer. The restrictions are described on this web page:


You have to specify the table name in the restrictions, then check the returned rows for the desired index name.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question