How to allow edit on datatable loaded from sqldatareader from view

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?
 
M

Mary Chipman [MSFT]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top