SSEM - How do you connect to an MDF file?

I have SQL Server Express 2005 (April CTP) along with SQL Server 2005 Express Manager (SSEM).  I am trying to create an ASP.NET web site using VS 2005 and in the process I want to create and use a smallish SSE database using an MDF file.  I thought I could connect to the MDF with SSEM to populate the DB with some data but I can't figure out how to connect.  Does SSEM support this   Is there a better way to do this - perhaps from within VS 2005

Answer this question

SSEM - How do you connect to an MDF file?

  • ljenner01

    Hi Keith
    Could you kindly mark my answer as helpful


  • Alex Wied

    Done.  Thanks again.
  • Gabo

    Mainly for anyone else reading this, alternatively you can right click your databases in EM and choose "Attach DB"...

    hths

  • Davidmi

    Yes you can in the express SKU, checkout Books On Line for AttachDBFilename in the connection string

  • Cameron Kloot

    This seems like the right approach but I get an error:

    .Net SqlClient Data Provider: Msg 5122, Level 16, State 1, Line 1
    Directory lookup for the file "C:\Projects\Foo\Trunk\App_Data\MyTestDB.mdf" failed with the operating system error 5(Access is denied.).

    What's weird is that I opened up the permissions (Everyone = FullControl).  Any ideas about why I might be getting this error

  • Karsten Januszewski

    Do you mean so you can see SQL tables from Access

    If so its, Tools > Database Utilities > Linked Table Manager...

    You can create a connection to a SQL table here.

    Or if you mean you want your application to talk to sql tables you need to create a data connection, data adapter and ultimately you would need the dataset...

    hth

  • Vikasumit

    Nevermind. I had not opened up the permissions on the parent dirs.  It connects now.  Thanks.
  • nick79

    Keith Hill wrote:
    Nevermind. I had not opened up the permissions on the parent dirs. It connects now. Thanks.


    Hi,
    How do you set the permissions I have the same problem.

    Regards

  • NRN

    Can we directly connect to the MDF file of the SQL server, in our program, as we do for Access

    Thanks



  • Jeff Mason

    Hi Keith

    I think you may use the sp_attach_db to do that

  • SSEM - How do you connect to an MDF file?