none
linq to sql and opening a connection? RRS feed

  • Question


  • Hello,

    i havent found yet a proper example. So when i use linq to sql with sql CE database do i open a connection with sqlceconnection or do i use the DataContext class?
    Sunday, September 21, 2008 10:30 PM

Answers

  • DataContext constructor accepts both:

    • either create a "connectionstring" for SQLCE database and pass it to datacontext constructor
    • or make a SQLCE connection explicitly and pass it to Datacontext.

    whichever is comfortable for you.

     

    ~Deepti

    Monday, September 22, 2008 5:36 PM

All replies

  • What is wrong with just passing the connection string into the constructor of the DataContext subclass generated by the LINQ to SQL designer?

    [)amien
    Monday, September 22, 2008 4:16 AM
    Moderator
  • DataContext constructor accepts both:

    • either create a "connectionstring" for SQLCE database and pass it to datacontext constructor
    • or make a SQLCE connection explicitly and pass it to Datacontext.

    whichever is comfortable for you.

     

    ~Deepti

    Monday, September 22, 2008 5:36 PM