views:

69

answers:

0

Wonder if anyone can help, I have created a database in C# 2010 (using the SQL Express installed with C# express) via the database explorer.

I can connect to the database using the connection string:

Data Source=.\SQLEXPRESS;AttachDbFilename=C:\temp\Documents\test.mdf;Integrated Security=True;Connect    Timeout=30;User Instance=True

Which is given in the properties window for the db. I'd like to get rid of the user instance and attachdbfilename and I am stuck already! Instead of user instance I'm trying:

@"Data Source=.\SQLEXPRESS; Integrated Security=True; AttachDbFilename=C:\temp\Documents\test.mdf;Initial Catalog=test"

But I get the error msg:

$exception  {"Unable to open the physical file \"C:\\temp\\Documents\\test.mdf\". Operating system error 32: \"32(failed to retrieve text for this error. Reason: 15105)\".\r\nCannot attach the file 'C:\\temp\\Documents\\test.mdf' as database 'test'."} System.Exception {System.Data.SqlClient.SqlException}

Does SQL express, when not installed as a separate application, support initial catalog?

Thanks!