I'm getting schema info but not so far able to bind it into datagrid columns, see code below I can print out the column-name and description and want to bind those into data grid columns

Dim schemaTable = dbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, _
                          New Object() {Nothing, Nothing, "VolDataNew", Nothing})
        For i = 0 To schemaTable.Rows.Count - 1
            Response.Write("i = " & i & "  " & schemaTable.Rows(i)!COLUMN_NAME.ToString & " IS " & schemaTable.Rows(i)!DESCRIPTION.ToString & "<br/>")
            gridTable.Rows.Add(schemaTable.Rows(i)!COLUMN_NAME.ToString, schemaTable.Rows(i)!DESCRIPTION.ToString)
        Next i

        grid1.DataSource = schemaTable

when i bind with the code below, I get all the columns from the table

<asp:Datagrid ID="grid1" runat="server" >
            <asp:TemplateColumn HeaderText="DESCRIPTION" >
                    <asp:Label ID="desc"
                               text='<%# DataBinder.Eval(Container.DataItem,"DESCRIPTION") %>'
                               runat="server" />

see rendered table in the attachment I want to only bind the COLUMN_NAME + DESCRIPTION table info into columns

I even tried creating a 2 column table, moving the the 2 columns to it, and binding that but it still rendered all the table columns, which seems really weird.

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Attachments GetOleDbSchemaTable_view.png 20.61 KB
7 Years
Discussion Span
Last Post by bbxrider

thanks, that was so easy
I got the message about using code brackets in the future, will do

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.