locked
Nested Linq to SQL Statment RRS feed

  • Question

  • User790468940 posted

    If i have the following table structure where ParentID is the parent Control for the current Selected Control (Nested Folder)

    ControlID               ControlName          ParentID

         1                         Folder1                  0

         2                         Folder2                  1

         3                         Folder3                  2

     

    How can i write a linq statement to populate the following Class

    Public class ControlFolder

     {

             Public string Name { get; set;}

              Public string ChildfolderName { get; set;}                       // where i map it to the ControlName in the database)

    }

     

    Look forward to get a feedback

    Sunday, November 30, 2008 7:30 PM

Answers

  • User-991446872 posted
    Create a DBML file and drop this table into it. then refer it using

    DataClassesDataContext dc = new DataClassesDataContext();

    dc.<TABLE NAME>

    You can then use generic list of your class to fetch the details.

    List<YOUR CLASS> Details = dc.<TABLE NAME>.Where(c => c.ID== ID).ToList() ;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 30, 2008 11:26 PM

All replies

  • User-991446872 posted
    Create a DBML file and drop this table into it. then refer it using

    DataClassesDataContext dc = new DataClassesDataContext();

    dc.<TABLE NAME>

    You can then use generic list of your class to fetch the details.

    List<YOUR CLASS> Details = dc.<TABLE NAME>.Where(c => c.ID== ID).ToList() ;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 30, 2008 11:26 PM
  • User-821857111 posted

    You've posted this question to the Access database forum.  Linq To SQL is not available for Access databases.

     

    Monday, December 1, 2008 2:51 AM