binding GetOleDbSchemaTable(OleDbSchemaGuid.Columns info to data grid RRS feed

  • Question

  • User-146799434 posted

    I'm using the GetOleDbSchemaTable to get column info from an access db, column_name and description, but getting an error that the bind statement can't get the properties. I know its there because I can response.write it from its table, schemaTable.Rows(i)!DESCRIPTION.ToString

    do I have to bind it differently than when binding actual data from a table using the column name for reference?

    System.Web.HttpException: DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a property with the name 'DESCRIPTION'.

    Monday, April 26, 2010 1:37 PM

All replies

  • User-146799434 posted

    perhaps making progress, but new problem. I built a 2 column data table for the datagrid source, using the info returned from GetOleDbSchemaTable. but the page displays 3 columns instead of 1 that I specified in the datagrid?????????

    Dim gridTable As New DataTable
            For i = 0 To schemaTable.Rows.Count - 1
                gridTable.Rows.Add(schemaTable.Rows(i)!COLUMN_NAME.ToString, schemaTable.Rows(i)!DESCRIPTION.ToString)
            Next i
            '4 Set the datagrid's datasource to the datareader and databind
            grid1.DataSource = gridTable

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

    what i get on the page is about like this - note column headers are in the same case as on page, so I'm getting both columns from the table I created plus an extra 3rd column!!! that is not even in the datagrid source table!!!

    DESCRIPTION                       column_name                   description

    desc 1 from table                 col name 1                        desc 1 from table (same as first column)

    next etc                               next etc                             next

    Monday, April 26, 2010 4:40 PM
  • User-146799434 posted

    since there is no response to this thread, I'm going to repost with a different title and hopefully better explanation to try and get results there

    Friday, April 30, 2010 1:29 PM