|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GetSchemaTable and Friendly Column NameLooking 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
Show quote
On Thu, 13 Apr 2006 11:50:23 -0500, "Michael Jackson" <michaeldjack***@cox.net> 1. Create a class that has two fields "ColumnName" and "FriendlyName".wrote: >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 > 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 Show quote "Otis Mukinfus" <ph***@emailaddress.com> wrote in message news:bo4u32lsprjqmpi2pm21vhjnh4m086kbth@4ax.com... > On Thu, 13 Apr 2006 11:50:23 -0500, "Michael Jackson" > <michaeldjack***@cox.net> > wrote: > >>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
Other interesting topics
|
|||||||||||||||||||||||