wenkket sethalam

wenkket sethalam

  • 1.6k
  • 128
  • 4.9k

How to populate Data to Dataset1 using Linq quary in C#

Dec 26 2017 5:59 AM
Hi
 
I am trying to set data to Dataset1 using Linq query, But the data source how to give I don't know
 
can anyone help me..
 
What I did..
 
1. I had created Dataset1 and given some column names
 
2. In Form1 write a Linq query to assign data to Dataset1 table, like below...
  1. DataClasses1DataContext DB = new DataClasses1DataContext();  
  2. var Quary1 = (from Gv in DB.Salses  
  3. join gi in DB.Items on Gv.Item_ID equals gi.ID  
  4. join Gp in DB.Item_Groups on Gv.Product_Group_ID equals Gp.ID  
  5. where Gv.Sno == txsno.Text  
  6. select new  
  7. {  
  8. ID = Gv.ID,  
  9. Group_Name = Gp.Item_Group_Name,  
  10. Item_Name = gi.Item_Name,  
  11. Qntity = Gv.Unit,  
  12. Price = Gv.Rate,  
  13. Total = Gv.Total_Amount,  
  14. gid = Gv.Product_Group_ID,  
  15. }).ToList();  
now here I want to give Dataset1 Datasource = Quary1
 
How to give

Answers (1)