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?
[445 byte] By [KeithHill] at [2008-1-28]
# 1
Hi Keith

I think you may use the sp_attach_db to do that

Eisa at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 2
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?

KeithHill at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 3
Nevermind. I had not opened up the permissions on the parent dirs. It connects now. Thanks.
KeithHill at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 4
Hi Keith
Could you kindly mark my answer as helpful ?
Eisa at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 5
Done. Thanks again.
KeithHill at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 6
Mainly for anyone else reading this, alternatively you can right click your databases in EM and choose "Attach DB"...

hths

BarryH at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 7
Can we directly connect to the MDF file of the SQL server, in our program, as we do for Access?

Thanks

AmitInnani at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 8
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

BarryH at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 9
Yes you can in the express SKU, checkout Books On Line for AttachDBFilename in the connection string
EuanGarden at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...
# 10
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

Parham.G at 2007-9-8 > top of Msdn Tech,SQL Server,SQL Server Tools General...

SQL Server

Site Classified