Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 27th, 2009, 11:25 PM
Registered User
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default Chapter 2 "An attempt to attach an auto-named database for file.."

It seems like I made some really stupid mistake somewhere following chapter 2, insert method.
Everything compiles OK but got an error from db.SubmitChanges();
[FONT='Times New Roman','serif']An attempt to attach an auto-named database for file C:\Users….Data_for_VS2008\HRPaidTimeOff.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.[/FONT]
Any Idea?
  #2 (permalink)  
Old May 28th, 2009, 07:17 PM
Authorized User
 
Join Date: Apr 2009
Posts: 41
Thanks: 1
Thanked 2 Times in 2 Posts
Default

Is your database where the connection string says it is? (C:\Users….Data_for_VS2008\HRPaidTimeOff.mdf)

Where in the code did you get the error?
  #3 (permalink)  
Old May 28th, 2009, 08:08 PM
Registered User
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

This thing drives me nuts.
I already deleted everything, started over, and got same error message.
I am using SQL Express 2008 with Vista Home.
My connection string in app.config HRTimePaidOffDAL looks like:
<connectionStrings>
<addname="V2.PaidTimeOffDAL.Properties.Settings.HRPaidTimeOf fConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\...\ HRPaidTimeOff.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
and pointed to the right location.
I tried to play around with security and User Instance – still getting same error message …
  #4 (permalink)  
Old May 28th, 2009, 08:17 PM
Registered User
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

And there is only Insert button click event in the code:

protectedvoid btnInsert_Click(object sender, EventArgs e)
{
HRPaidTimeOffDataContext db = newHRPaidTimeOffDataContext();
ENTUserAccount userAccount = newENTUserAccount
{
WindowsAccountName =
@"VARALLO1\VaralloMadison",
FirstName =
"Madison",
LastName =
"Varallo",
Email =
"madison2222@yahoo.com",
IsActive =
true,
InsertDate =
DateTime.Now,
InsertENTUserAccountId = 1,
UpdateDate =
DateTime.Now,
UpdateENTUserAccountId = 1
};
db.ENTUserAccounts.InsertOnSubmit(userAccount);
db.SubmitChanges();
}
  #5 (permalink)  
Old May 28th, 2009, 11:55 PM
Registered User
 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

Finally made it work. But it works only if I put my data base into web site's App_Data folder ...
The Following User Says Thank You to Gredkins For This Useful Post:
stevemonty (July 27th, 2009)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a files general property of "Type of file" GregSivers Visual Basic 2008 Essentials 7 June 3rd, 2009 09:38 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM
Chapter 29, The "Simple" Exercise slginps BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 1 April 25th, 2009 01:40 PM
Chapter-5 on Intents:ContactPickerTester does not show the button "Pick a Contact" sunilm12 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 April 15th, 2009 11:55 AM
Message received by "FILE" adapter is suspended skindika Biztalk 0 February 2nd, 2009 07:06 PM



All times are GMT -4. The time now is 07:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.