How to allow edit on datatable loaded from sqldatareader from view

  • Thread starter Thread starter Clay
  • Start date Start date
C

Clay

I am getting the error System.Data.ReadOnlyException was unhandled
Message="Column 'name' is read only." that I need to resolve and not sure
how. We are querying an MSSQL server view that is returned as an
SqlDataReader. We then load a datatable from the return sqldatareader. In
our application we need to mask/hide data based on user permissions. I am
looping through each datarow and trying to edit the columns that need to be
masked. We are only using the datatable to present the data in a grid. The
user can't change or save the information back to the database. How can I
allow edit on the datatable?
 
I'd tackle the problem from the other end, and only fetch the data you
want the user to see by creating a store procedure that takes the user
name as an input parameter. Or if not a stored procedure, add a WHERE
clause to apply the appropriate filter.

--Mary
 
Back
Top