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

x
?
Solved

SqlConnection.GetSchema Problems

Posted on 2014-08-07
2
Medium Priority
?
275 Views
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
        Else
            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?
0
Comment
Question by:MikeBroderick
  • 2
2 Comments
 

Author Comment

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

http://msdn.microsoft.com/library/ms254969.aspx
0
 

Accepted Solution

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

http://msdn.microsoft.com/en-us/library/cc716722(v=vs.100).aspx

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

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