I was just wondering if it is possible to make some columns returned by a query read-only, I know I can make the whole result read-only but I would like it on only some columns
You can set the ReadOnly property of a DataColumn of a DataTable, but it won't help you getting an exception if you're using it in for example an editable grid. Instead set the grid column or other edit control readonly.
A DataColumn in a DataTable can be read only -> set this in the properties for that column in the dataset designer (or in code if you didnt use the designer)
A DataGridViewXXXColumn can also be read only -> set this in the properties for that column in the .Columns property of the DataGridView in the form designer
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.