Edit the contents of a loaded SQL DataReader?

  • Thread starter Thread starter Jack Black
  • Start date Start date
J

Jack Black

Hi, all! I have a populated Reader that I'm binding to a data grid,
and I'm trying to figure out how I can edit cells BEFORE binding the
reader to the DataGrid. Of the few pieces of sample code I've seen a
DataSet is required, and I really don't want to dump a lot of code
into something that may not need it: a quick bind to a reader dumps
data perfectly with zero hassle! ;-)

Obviously the Reader is (duh) read only, so I was wondering if there
was some other quick way to get where I want to go. Essentially, I
just want a simple text replacement on the contents of a field in the
recordset: for example, replace a "99" with "1999" (just an example,
not a date thing).

Thoughts?? Thanks in advance!
Jack
 
Jack Black said:
Hi, all! I have a populated Reader that I'm binding to a data grid,
and I'm trying to figure out how I can edit cells BEFORE binding the
reader to the DataGrid. Of the few pieces of sample code I've seen a
DataSet is required, and I really don't want to dump a lot of code
into something that may not need it: a quick bind to a reader dumps
data perfectly with zero hassle! ;-)

Obviously the Reader is (duh) read only, so I was wondering if there
was some other quick way to get where I want to go. Essentially, I
just want a simple text replacement on the contents of a field in the
recordset: for example, replace a "99" with "1999" (just an example,
not a date thing).

Thoughts?? Thanks in advance!
Jack

As you know, DataReader is read-only forward only so you cannot change any
field or record. The solution is to work in the event around the bind to the
datagrid.

You could change this value in the ItemDataBound event of the DataGrid.
 
Back
Top