Linq query: append column to query results?

Couple points, first: new DataTable() is redundant; you're instantiating a rather expensive object that will never be used because you're overwriting the reference in the very next line. You should consider removing the initialization and then joining the declaration and the actual assignment on one line.

Couple points, first: new DataTable() is redundant; you're instantiating a rather expensive object that will never be used because you're overwriting the reference in the very next line. You should consider removing the initialization and then joining the declaration and the actual assignment on one line. Getting to the real question.

DataRows cannot have columns added to them directly; you have to add the column to the entire DataTable containing those rows. Once that's done, just set the value. As long as you don't need the operation translated into an external query language like SQL, you can inline this operation using a monadic extension method: DataTable dt = myDataSet.

MyDataTable; dt.Columns. Add("MaxField1"); EnumerableRowCollection qrySelectRecords = (from d in dt.Rows().AsEnumerable().OfType() where d. Field("readingDate") >= startDate && d.

Field("readingDate") dr.Field("field1")) select d. WithColumnSet("MaxField1", m)); ... public static DataRow WithColumnSet(this DataRow input, string columnName, object value) { inputcolumnName = value; return input; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions