My code for sql connection using linq is:
var query1 = from u in dc.Usage_Computers where u.DomainUser == s3 select u; // selects all feilds from table GridView1.DataSource = query1; GridView1.DataBind();
I have a field called ‘Operation’ in the table ‘Domainuser’ which has values like ‘1, 2, 3’. When I populate these values to data grid I wanted to convert them to meaningful values like if the value of Operation is 1 then display in datagrid as ‘logon’, if 2 then ‘logoff’ etc…
How do i assign values for them after retrieving from database?
This technique does not seem particularly applicable to your problem, but here it is anyway.
You can create a SQL case statement in LinqToSql by using the C# ? : operator.