locked
Attaching an SQL Server Database File RRS feed

  • Question

  • Is is possible to attach an SQL Server Database file when the project first opens or is it necessary to add the database to SQL Server Express before it can be used?

    Thanks ... bill

    Wednesday, August 18, 2010 11:42 PM

Answers

  • Hi Bill,

    Yes, you can easily attach to an external SQL Server database instead of using the intrinsic SQL Express database, or you can use both. See the following topic for more info: http://msdn.microsoft.com/en-us/library/ff852017.aspx

     


    Steve Hoag Microsoft aka the V-Bee
    • Marked as answer by burrowsUW Thursday, August 19, 2010 12:47 AM
    Wednesday, August 18, 2010 11:53 PM
    Moderator
  • Hi Bill,

    You will need to add the database file to a SQL Server instance prior to it being used in LightSwitch.  It is possible to do this using the connection dialog in Visual Studio.

    1. In the connection dialog, select a server instance (for example .\SQLEXPRESS)
    2. In the Connect to a Database section, select the database file and provide a logical name for it

    This database file will be attached to the SQL Server (it will not be a user instance).  You will need to refer to it using the logical name you specified.

    Thanks!

    • Marked as answer by burrowsUW Thursday, August 19, 2010 12:47 AM
    Thursday, August 19, 2010 12:24 AM

All replies

  • Hi Bill,

    Yes, you can easily attach to an external SQL Server database instead of using the intrinsic SQL Express database, or you can use both. See the following topic for more info: http://msdn.microsoft.com/en-us/library/ff852017.aspx

     


    Steve Hoag Microsoft aka the V-Bee
    • Marked as answer by burrowsUW Thursday, August 19, 2010 12:47 AM
    Wednesday, August 18, 2010 11:53 PM
    Moderator
  • Hi Bill,

    You will need to add the database file to a SQL Server instance prior to it being used in LightSwitch.  It is possible to do this using the connection dialog in Visual Studio.

    1. In the connection dialog, select a server instance (for example .\SQLEXPRESS)
    2. In the Connect to a Database section, select the database file and provide a logical name for it

    This database file will be attached to the SQL Server (it will not be a user instance).  You will need to refer to it using the logical name you specified.

    Thanks!

    • Marked as answer by burrowsUW Thursday, August 19, 2010 12:47 AM
    Thursday, August 19, 2010 12:24 AM
  • I am used to the dialog that is available in things like creating an EF model from a database. There I can specify the SQL Database file name and it takes care of attaching the DB for me.

    Maybe in furure releases you might consider showing a diaglog like this when the user starts out with an existing database. It seems uncomfortable for me to ask to use an existing database BUT I need to have connected it first.

    bill

    Thursday, August 19, 2010 12:53 AM