GetSchemaTable and Friendly Column Name

  • Thread starter Thread starter Michael Jackson
  • Start date Start date
M

Michael Jackson

Looking for a suggestion.

Using .NET 2003 and SQL Server 2000, I'm using GetSchemaTable to get the
schema of mutiple tables. I populate a listbox with the column names and
allow the user to multi-select the column names, then using the selected
column names, I create a query returning just those columns.

However, I would like to present the user with a "friendly name" for the
column rather than the column name from the table, e.g. Employee Name as
opposed to EmpName.

When designing a table in SQL Server Enterprise Manager, you can enter a
Description for the column. How could I use that information?

Michael
 
Looking for a suggestion.

Using .NET 2003 and SQL Server 2000, I'm using GetSchemaTable to get the
schema of mutiple tables. I populate a listbox with the column names and
allow the user to multi-select the column names, then using the selected
column names, I create a query returning just those columns.

However, I would like to present the user with a "friendly name" for the
column rather than the column name from the table, e.g. Employee Name as
opposed to EmpName.

When designing a table in SQL Server Enterprise Manager, you can enter a
Description for the column. How could I use that information?

Michael

1. Create a class that has two fields "ColumnName" and "FriendlyName".
2. override the ToString() method of the class to return the "FriendlyName"
field.

3. Add the classes to the list box. The list box will display the String
returned by the objects ToString() method.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Thanks for the reply.

But where does "Friendly Name" come from? GetSchemaTable has no such
property? I hesitate to use system tables because we want to migrate to SQL
Server 2005 soon.


Michael Jackson
 
Back
Top