locked
Test linq to sql RRS feed

  • Question

  • User438204031 posted

    Hi,

     now i am learning Linq to sql, i want to add a sample database to vs2015 to test the linq query . How to achieve it ?

    thanks

    Wednesday, October 12, 2016 7:05 AM

Answers

  • User1724605321 posted

    Hi ,

    Do you mean something like "add Northwind database in Visual Studio" ? Do you have a .bak file ? If that is your requirement ,you need get the logical names of the database and log files inside the .bak file:

    RESTORE FILELISTONLY  
    FROM DISK = 'C:\nw\northwind.bak'  
    GO  
    

    Then run below query to create the database :

    RESTORE DATABASE Northwind  
    FROM DISK = 'c:\nw\northwind.bak'  
    WITH MOVE 'Northwind' TO 'c:\nw\northwind.mdf',  
    MOVE 'Northwind_log' TO 'c:\nw\northwind.ldf' 

    You could click here for detail steps .

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 12, 2016 7:21 AM

All replies

  • User1724605321 posted

    Hi ,

    Do you mean something like "add Northwind database in Visual Studio" ? Do you have a .bak file ? If that is your requirement ,you need get the logical names of the database and log files inside the .bak file:

    RESTORE FILELISTONLY  
    FROM DISK = 'C:\nw\northwind.bak'  
    GO  
    

    Then run below query to create the database :

    RESTORE DATABASE Northwind  
    FROM DISK = 'c:\nw\northwind.bak'  
    WITH MOVE 'Northwind' TO 'c:\nw\northwind.mdf',  
    MOVE 'Northwind_log' TO 'c:\nw\northwind.ldf' 

    You could click here for detail steps .

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 12, 2016 7:21 AM
  • User438204031 posted

    I will try it.

    Wednesday, October 12, 2016 8:14 AM