Click here to Skip to main content
11,714,776 members (78,789 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0

i want to install c# windows application.
i have installed .net framework 3.5 & sql server 2005 in the system.
and i have used connection string as
(cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Demo_DB.mdf;Integrated Security=True;User Instance=True");

but i am getting error as mentioned below :

cannot create file 'c:\default company name\hotelsetup\newhotel_log.ldf' because it already exists.
change the file path or the file name. and retry the operation.
could not open new database 'newhotel'. create database is aborted.
cannot attach the file 'c:\default company name\hotelsetup\newhotel.mdf' as database 'newhotel'
file activation failure. the physical file name 'E:\\....' may be

can anyone please give me the solution?

i have database in bin folder as well as in project folder.

thanks in advance
Posted 1-Feb-13 21:02pm
Edited 1-Feb-13 21:17pm
Krunal Rohit at 2-Feb-13 3:07am
Delete c:\default company name\hotelsetup\newhotel_log.ldf

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 570
1 Richard MacCutchan 275
2 Maciej Los 274
3 OriginalGriff 140
4 CHill60 135
0 Sergey Alexandrovich Kryukov 545
1 CHill60 375
2 Maciej Los 324
3 Richard MacCutchan 310
4 OriginalGriff 260

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 2 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100