help I'm confused, linq/dataset/tableadapter..

vlandmist

New member
Joined
Mar 1, 2008
Messages
3
Programming Experience
Beginner
Add a new calculated column in a linq datacontext datagrid ??

I start with a collection of objects that I insert in my database, and I've done that using linq and datacontext

my problem:

I want to add a column in the datagridview and I want to see the days elapsed by calculating a difference between the "StartDate" column in my database and the current date.
plus I want to format it with a different color if days are > 7

but how do I add this column? I don't want to store it in the database, is redoundant and I if try to add it as a new column in the object manager .dbml I get a runtime error "Invalid column name 'ElapsedDays"... because is not databound. I can add it as Unbound column but how can I manage it?


thanks
 
It seems that I managed to achieve what I wanted with a Partial Class...
I can add more columns in the datagridview (bound to the db table), creating new properties in the partial class of my Data Class

i don't know if it's the right way to do it but it seems to work for now
 
Back
Top