SqlConnection.GetSchema Problems

Posted on 2014-08-07
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

    Author Comment

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

    Accepted Solution

    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

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now