Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 260857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:23:00+00:00 2026-05-11T22:23:00+00:00

In ADO.NET i’m using GetSchemaTable to return the schema table for a results set.

  • 0

In ADO.NET i’m using GetSchemaTable to return the schema table for a results set.

DataTable schema = rdr.GetSchemaTable();
gridSchema.DataSource = schema;
gridSchema.DataBind();

Unfortunatly the “ProviderType” value is displaying as an integer, rather than the OleDbType enumeration value that it is:

ProviderType     Desired Display Value
============     =====================
129              Char
3                Integer
129              Char
129              Char
3                Integer
3                Integer
129              Char
135              DBTimeStamp
129              Char
129              Char
...

All these integers are the the enumeration values for the OleDbType enumeration:

public enum OleDbType
{
    Empty = 0,
    SmallInt = 2,
    Integer = 3,
    Single = 4,
    Double = 5,
    Currency = 6,
    Date = 7,
    BSTR = 8,
    IDispatch = 9,
    Error = 10,
    Boolean = 11,
    Variant = 12,
    IUnknown = 13,
    Decimal = 14,
    TinyInt = 16,
    UnsignedTinyInt = 17,
    UnsignedSmallInt = 18,
    UnsignedInt = 19,
    BigInt = 20,
    UnsignedBigInt = 21,
    Filetime = 64,
    Guid = 72,
    Binary = 128,
    Char = 129,
    WChar = 130,
    Numeric = 131,
    DBDate = 133,
    DBTime = 134,
    DBTimeStamp = 135,
    PropVariant = 138,
    VarNumeric = 139,
    VarChar = 200,
    LongVarChar = 201,
    VarWChar = 202,
    LongVarWChar = 203,
    VarBinary = 204,
    LongVarBinary = 205,
}

i want to display the data type as something human readable, rather than an integer.


i’ve tried looping through the schema DataTable and modify the values inside the DataTable:

DataTable schema = rdr.GetSchemaTable();

//Change providerType column to be readable
foreach (DataRow row in schema.Rows)
{
   OleDbType t = (OleDbType)row["ProviderType"];
   row["ProviderType"] = t.ToString();
}

gridSchema.DataSource = schema;
gridSchema.DataBind();

But that throws an exception:

Column 'ProviderType' is read only.

i even looked at the GridView’s RowDataBound event, thinking i could change the value as it is rendered:

protected void gridSchema_RowDataBound(object sender, GridViewRowEventArgs e)
{
   //todo: magic
   //e.Row["ProviderType"]
}

But it doesn’t look like you can play with rendered values.

Can anyone suggest a nice way to much with the value of the ProviderType column so that it is human readable when i display it to humans?


Update

The workaround i’m using right now is tack an extra column on the end:

DataTable schema = rdr.GetSchemaTable();

schema.Columns.Add("OleDbDataType", typeof(String));
schema.Columns.Add("CLRDataType", typeof(String));
foreach (DataRow row in schema.Rows)
{
   //Show the actual provider type
   OleDbType t = (OleDbType)row["ProviderType"];
   row["OleDbDataType"] = t.ToString();

   //Show the corresponding CLR type while we're doing a hack
   row["CLRDataType"] = row["DataType"].ToString();
}

gridSchema.DataSource = schema;
gridSchema.DataBind();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:23:00+00:00Added an answer on May 11, 2026 at 10:23 pm

    I might be completely off here, but can’t you just set the ReadOnly property of the column to false? Like:

    schema.Columns["ProviderType"].ReadOnly = false;
    

    Afterwards you might get a columntype problem as you’re trying to put a string value into a integer column. But this should get you into the right direction.

    edit:

    Solving the columntype issue:

    DataTable newTable = schema.Clone();
    newTable.Columns["ProviderType"].DataType = typeof(string);
    
    foreach (DataRow dr in schema.Rows)
    {
        DataRow newRow = newTable.NewRow();
        // fill newRow with correct data and newly formatted providertype
    
        newTable.Rows.Add(newRow);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you loading your data on a background thread? Your… May 12, 2026 at 12:34 am
  • Editorial Team
    Editorial Team added an answer What you are looking for is either Uri.AbsolutePath or Uri.PathAndQuery.… May 12, 2026 at 12:34 am
  • Editorial Team
    Editorial Team added an answer You can use AppDomain.GetAssemblies to see which are already loaded. May 12, 2026 at 12:34 am

Related Questions

In ADO.NET i'm using GetSchemaTable to return the schema table for a results set.
In ADO.Net/SQLClient I would often do something like this: SELECT COUNT(*) FROM SomeTable WHERE
I need to use tables from a DB which I cannot alter (using linked
In the ADO.Net Entity Framework, I have an object which has 4 references to
I have a question that I'm struggling with in ADO.NET Data Services: When assembling

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.