Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if we have 3 records with employeeID,name and dateofbirth coloumns..and we have to show two coloumns out of these three coloumns ..then how can you show these two coloumns records in grid view using c# code inserting LINQ code in it ?
Posted
Updated 5-Oct-10 14:36pm
v4
Comments
Henry Minute 4-Oct-10 16:39pm    
I have removed your attempts at formatting, since they failed. They are also not necessary. No one can tell if your question is emboldened or enlarged until they open it and, if it is, most will ignore it
Sandeep Mewara 5-Oct-10 16:56pm    
Update from OP:
I think,ppls are not able to get my question....my question is:----
if we have 3 records with employeeID,name and dateofbirth coloumns..and we have to show two coloumns out of these three coloumns ..then how can you show these two coloumns records in grid view using c# code inserting LINQ code in it ?

I Understand ur Question.

{
var r= from c in ct.Emp(table)
select new{c.EmpId,c.EmpName}

datagridview1.DataSource=r;
}
 
Share this answer
 
putting data into a GridView has nothing to do with how you retrieve the data. What's your real question?
 
Share this answer
 
C#
void fillCh()
{
    dgChofer.Rows.Clear();
    clasedetablasDataContext ct = new clasedetablasDataContext();
    var q = from c in ct.tblchofers
            select c;
    foreach (var x in q)
    {
        dgChofer.Rows.Add(x.idchofer.ToString(), x.nombreChofer, x.apellidoChofer, x.estadoChofer);
    }
}


i hope this help!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900