Can't add connection via Visual C# Express

P

Paolo

Hope someone can help with this problem...

Using SQL Server Express 2008 and SQL Server Management Studio Express 2008
running on a desktop PC.

When I try to add a database via Management Studio there is no problem, the
database appears in the Explorer.

In Visual C# Express, when I try to 'Add Connection' as follows

Data source - MS SQL Server Database File
Database File Name - browse to appropriate folder and select
Log in using WIndows Authentification

and use the same database I receive the message "The FOR ATTACH option
requires that at least the primary file be specified. An attempt to attach an
auto named database at <filepath\databasename> failed. A database with the
same name exists or specified file cannot be opened or is located on UNC
store".

Looking for a solution if possible.

Thanks
 
M

Morten Wennevik [C# MVP]

Paolo said:
Hope someone can help with this problem...

Using SQL Server Express 2008 and SQL Server Management Studio Express 2008
running on a desktop PC.

When I try to add a database via Management Studio there is no problem, the
database appears in the Explorer.

In Visual C# Express, when I try to 'Add Connection' as follows

Data source - MS SQL Server Database File
Database File Name - browse to appropriate folder and select
Log in using WIndows Authentification

and use the same database I receive the message "The FOR ATTACH option
requires that at least the primary file be specified. An attempt to attach an
auto named database at <filepath\databasename> failed. A database with the
same name exists or specified file cannot be opened or is located on UNC
store".

Looking for a solution if possible.

Thanks

Hi Paolo.

This error usually indicates the database is not complete (missing log files
etc) or not detached properly. You say you have loaded the database in Sql
Server Express. You may need to detach the database before connecto to the
file. Can you connect to the database via the sql server?
 
P

Paolo

Morten: I believe it may be something to do with parent and user instances of
the database I am trying to connect to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top