Elegant way of returning FieldNames?

  • Thread starter Thread starter Jay Balapa
  • Start date Start date
J

Jay Balapa

Hello,

Iam creating a query page, in which a Drop Down List will have collection of
fieldnames.

Is there a elegant way of doing it?

Currently Iam opening up a datareader and using GetName()/FieldCount() to
get to fieldnames.


I feel is is a waste, why would you need a resultset to get the
fieldNamelist?


Thanks
Jay
 
Agreed:

You can use getSchemaTable or schemaOnly http://www.c-
sharpcorner.com/FAQ/Part1Howdos.asp
if all you want to do it retrieve table info.

I have an app that simulates Enterprise Manager, but it's
for MSDE and I use this extensively.

Easy and powerful. If you have any trouble, let me know.

Good Luck,

Bill



Cordially,

W.G. Ryan
(e-mail address removed)
www.knowdotnet.com
 
A good MS articles exist that may be worth reading, it kinda explains when
to use Datareader and why you would

"HOW TO: Retrieve Column Schema by Using the DataReader GetSchemaTable
Method and Visual C# .NET"
http://support.microsoft.com/?id=310107

Alos an interesting read

"HOW TO: Retrieve Schema Information by Using GetOleDbSchemaTable and Visual
C# .NET"
http://support.microsoft.com/?id=309681


--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Back
Top