score:1

Accepted answer
public static list<category> getcategorylist()
{
    try
    {
        using (var db = new linqtodbawkodatacontext())
        {
            var list = from c in db.tblcategories
                       join s in db.tblsubcategories
                       select new category
                       {
                           id = c.catid,
                           catname = c.catname,
                           subcat = s.subcatname
                       };
            return list.tolist();
        }
    }
    catch (exception ex)
    {
        throw new exception("an error has occured");
    }            
}

Related Query

More Query from same tag