a basic question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm new to ADO.NET. I'm have a very basic problem and trying to figure
out what is the best way to approach in .net. I just need to display some
fields of a table (read only), but I need to choose which fields to display
depending on the value of a field. Which one of the web controls and ADO
class is best fit to this purpose? (so, for example if columnA='a', display
coloum B C D, otherwise display column D E F...)

TIA.
 
There are several approaches to this problem (as usual).
One way would be to fetch all of the columns and use client-side logic to
view or hide appropriate columns.
Another way would be to write a stored procedure that chooses an appropriate
SELECT statement based on logic.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Hi, Bill, what do you mean by client-side logic? I could read them into a
SqlDataReader, but then what's the good .net way of displaying them, say if
(db column)location='us' then display (column)zip as "Postal", otherwise
display (column)province as "Postal. I could do it the hard way, looping
through the reader and construct my own table,then bind the table to some
data control, but there should be an easier way... or not?
 
I would not use the DataReader for this--just execute Fill and bind to one
or more controls as needed.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top