473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Can't add connection via Visual C# Express

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\databasenamefailed. 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

Sep 10 '08 #1
2 2081
"Paolo" wrote:
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\databasenamefailed. 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?

--
Happy Coding!
Morten Wennevik [C# MVP]
Sep 12 '08 #2
Morten: I believe it may be something to do with parent and user instances of
the database I am trying to connect to.

"Morten Wennevik [C# MVP]" wrote:
"Paolo" wrote:
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\databasenamefailed. 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?

--
Happy Coding!
Morten Wennevik [C# MVP]
Sep 13 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jack | last post by:
Will these be add-ons to Whidby?
3
by: clintonG | last post by:
Visual C# 2005 Express Edition is a simple, lightweight, integrated development environment designed for beginning programmers and non-professional developers interested in building Windows Forms,...
3
by: Dan Sikorsky | last post by:
Can I use SQLServer 2000 with ASP.NET 2.0 instead of SQLServer 2005, and use the .Net 2.0 Membership functionality? I've setup my Login page, controls, etc., and now it's time to use the Web...
1
by: Claudia Fong | last post by:
Hi, I'm trying to connect an access database into my c# application. But I'm having trouble to Drag and drop the data connection on the Form to create an OleDbConnection object. I used to use...
0
by: Larry Rebich | last post by:
I am trying to use the sample web template that is distributed with Visual Studio 2005 called 'Personal Web Site Starter Kit'. After running for awhile it fails with the following message: ...
2
by: Sasquatch | last post by:
I'm still having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight...
3
by: lieven.becue | last post by:
Situation: at work we have a windows 2003 server with MS sql server 2005 express. With my pc at work, I can see my own database I created. At home. I can connect with VPN to the network. With...
1
by: pmclinn | last post by:
I have created a DB from within my Visual studio 2005 development studio. My connection string works well on my local machine but when I copy this to my remote server I get this error: When...
2
by: cpchan | last post by:
Hello, Can I create a Web-based application (not a Web site) with Visual C# 2005 Express ? Or I have to use Visual Web Developer 2005 Express Edition, choose ASP.NET and then choose C# ? Are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.