Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

SQL Server Express Attach
I am trying to create a conneciton to an SQL Server Express database from
.NET. Here is my connection string:

'Data Source=. \SQLEXPRESS;AttachDb
Filename="c:\database.mdf";Integrated
 Security=True;Connec
t Timeout=30;User Instance=True'

However, I get the following error:

'An attempt to attach an auto-named database for file c:\database.mdf
failed. A database with the same name exists, or specified file cannot be
opened, or it is located on UNC share.'

I then used SSEUtil to list all attached databases and it was not there, and
I also tried to detach it anyway but I was told that 'No valid database path
matches teh value specified.' and rightly so.

But then I tried to attach the database from within SSEUtil and it quite
happily attached the database just fine. Surely if I can't attach using
ADO.NET that why can I attach using SSEUtil?

Any ideas?

TIA




Report this thread to moderator Post Follow-up to this message
Old Post
elziko
02-25-06 02:27 PM


Re: SQL Server Express Attach
See if these help:

http://msdn.microsoft.com/library/d...r />
rview.asp
Express Overview
http://msdn2.microsoft.com/en-us/library/ms165672.aspx  Comparing Express
with MSDE
http://msdn.microsoft.com/sql/defau... />
erinst.asp
User Instances
http://www.datamasker.com/SSE2005_NetworkCfg.htm       Configuring Express
for Remote Access

--
Andrew J. Kelly  SQL MVP


"elziko" <elziko@yahoo.co.uk> wrote in message
news:O4urfpSOGHA.3984@TK2MSFTNGP14.phx.gbl...
>I am trying to create a conneciton to an SQL Server Express database from
>.NET. Here is my connection string:
>
> 'Data Source=. \SQLEXPRESS;AttachDb
Filename="c:\database.mdf";Integrated
>  Security=True;Connec
t Timeout=30;User Instance=True'
>
> However, I get the following error:
>
> 'An attempt to attach an auto-named database for file c:\database.mdf
> failed. A database with the same name exists, or specified file cannot be
> opened, or it is located on UNC share.'
>
> I then used SSEUtil to list all attached databases and it was not there,
> and I also tried to detach it anyway but I was told that 'No valid
> database path matches teh value specified.' and rightly so.
>
> But then I tried to attach the database from within SSEUtil and it quite
> happily attached the database just fine. Surely if I can't attach using
> ADO.NET that why can I attach using SSEUtil?
>
> Any ideas?
>
> TIA
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Andrew J. Kelly
02-25-06 02:27 PM


Re: SQL Server Express Attach
Andrew J. Kelly  wrote:
> See if these help:
>
> http://msdn.microsoft.com/library/d.../>
verview.asp
> Express Overview
> http://msdn2.microsoft.com/en-us/library/ms165672.aspx  Comparing
> Express with MSDE
> http://msdn.microsoft.com/sql/defau...>
userinst.asp
> User Instances
> http://www.datamasker.com/SSE2005_NetworkCfg.htm       Configuring
> Express for Remote Access

Thanks, I read through those links and didn't find anythig that really
helped. From what I see teh way I'm connecting shouldn't cause any problems!
It almost seems like SSE things the database is still attached when its not.
FWIW, the mdf I'm using is on my local machine.



Report this thread to moderator Post Follow-up to this message
Old Post
elziko
03-01-06 01:23 AM


Re: SQL Server Express Attach
How are you trying to attach from .NET?  are you using C# or an ASP.Net
Page?  I assume you're using .Net 2.0.  Can you attach from the IDE?  How
did you create this database in the first place?

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"elziko" <elziko@yahoo.co.uk> wrote in message
news:%232BBnO4OGHA.140@TK2MSFTNGP12.phx.gbl...
> Andrew J. Kelly wrote: 
>
> Thanks, I read through those links and didn't find anythig that really
> helped. From what I see teh way I'm connecting shouldn't cause any
> problems! It almost seems like SSE things the database is still attached
> when its not. FWIW, the mdf I'm using is on my local machine.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Roger Wolter[MSFT]
03-01-06 01:23 AM


Re: SQL Server Express Attach
Roger Wolter[MSFT]  wrote:
> How are you trying to attach from .NET?  are you using C# or an
> ASP.Net Page?  I assume you're using .Net 2.0.  Can you attach from
> the IDE?  How did you create this database in the first place?

I found a tiny typo when I was building my connection string where I was
using a forward slash instead of a back-slash. Very frustrating!

Thanks to both of you for helping though!



Report this thread to moderator Post Follow-up to this message
Old Post
elziko
03-01-06 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 05:34 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006