I have defined the following variable
var result = from report in firoozehDataContext.Reports select report;
now if i want delete One of the columns in the variable, how do i it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unless you have grave concerns about performance, this seems like the kind of thing that should be handled at the UI level and not in your data access code.
I get the impression that you are taking the results of this query and binding to a grid or list with auto-generated columns. However, it is much easier (and safer) to control which columns are visible in a grid than it is to dynamically build a SQL SELECT query. Auto-generated columns are really only appropriate for scaffolding scenarios.
Another good reason why I would recommend against doing what you’re doing is that every time your end user decides to hide (or re-show) another column, you’re forced to re-run your entire query. This is almost certainly not what you really want.
I would simply select all the columns that could be available and hide the ones that shouldn’t be available as part of the UI code.