Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connect to SQL Express and .mdf file?
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01165242
Message ID:
01165945
Views:
15
If your database is already connected to SQL Server as a non-file based database (ie. it's attached) then you can't connect to it as a file database. So either remove the attached database or use the attached connection (which is preferrable as its much faster to start up - SQL Express basically attaches and detaches file databases on the fly which takes time on startup).

+++ Rick ---

>Greeting Rick,
>
>That's what the connection string looks like. The exception error says "A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
>
>Regarding these possibilities:
>1) I know it exists - isn't the B.O.G. going to use it to generate objects?
>2) The Server Explorer is showing the database info, would this preclude the B.O.G. from accessing the file?
>3) The file is on my c drive.
>
>Thanks for your help.
>
>Regards,
>
>E.R.
>>>>
>>>>If you use IIS rather than the built in provider - it doesn't work well. If you use IIS you'd be best off adding the database as a fixed SQL Express database rather than a file access one because of permissions settings.
>>>>
>>>>http://west-wind.com/WebLog/posts/5063.aspx
>>>
>>>Thanks for the info Rick. Right now I'm just trying to get the Mere Mortals Business Object Generator to see my database in the app_data folder. I'm getting an exception in the Business Object Generator wizard when I put in the connection string that's in my web.config. The format of the connection string is different when you're just using an .mdf file rather than a regular database and I'm guessing that MM doesn't know how to use that type of connection.
>>
>>It's just a connection string. The format should look like this:
>>
>>Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AjaxAspNet_Data.mdf;Integrated Security=True;User Instance=True
>>
>>As long as the connection string is valid the SQL provider will just work with it.
>>
>>
>>+++ Rick ---
>>
>>>
>>>Regards,
>>>
>>>E.R.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform