Click here to Skip to main content
16,004,647 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Here the following code using Ado.net but i want to convert it into Linq

C#
SqlConnection con1 = new SqlConnection(con);

SqlDataAdapter dadCats = new SqlDataAdapter("select  menuid,menuname,imageurl,parentmenuid from  menus where menutype= 'mainmenu' and  menulevel='0' and menuid='5'", con1);

SqlDataAdapter dadCats1 = new SqlDataAdapter("select menuid,menuname, parentmenuid,urlname,imageurl from  menus where menutype= 'submenu' and menulevel='1' and parentmenuid='5'", con1);

SqlDataAdapter dadCats2 = new SqlDataAdapter("select menuid,menuname, parentmenuid,urlname,imageurl from  menus where menutype= 'submenu' and menulevel='2'and parentmenuid in(6,7,8,9,10)", con1);
DataSet dst = new DataSet();

dadCats.Fill(dst, "Menu");
dadCats1.Fill(dst, "Menu1");
dadCats2.Fill(dst, "Menu2");

dst.Relations.Add("Children", dst.Tables["Menu"].Columns["menuid"], dst.Tables["Menu1"].Columns["parentmenuid"]);
dst.Relations.Add("Children1", dst.Tables["Menu1"].Columns["menuid"], dst.Tables["Menu2"].Columns["parentmenuid"]);
Posted
Updated 28-Nov-09 8:20am
v2

1 solution

You are asking us to do your work for you. I suggest you read some books and/or articles on LINQ. Here is a good starting point: LINQ Page. Here is another: Code Project Article: LINQ Introduction Part 1 Of 3.
 
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